Im hosting a mobile backend (written in Java) in App engine standard environment
using Cloud endpoint framework 2.0
, which I can access by this URL https://api-dot-[projectId]-appspot.com/_ah/api/myApi/v1/path
now Im trying to use a custom domain [api.mydomain.app] and here what I've done:
1- I've added this domain api.mydomain.app
in my appengine setting and its now verified and has a valid SSL managed by google
2- I've added the 8 DNS records (A & AAAA) in this domain "mydomain.app" in godaddy like below:
A api xxxxxxx
A api xxxxxxx
A api xxxxxxx
A api xxxxxxx
AAAA api xxxxxxx
AAAA api xxxxxxx
AAAA api xxxxxxx
AAAA api xxxxxxx
and I have the same records for @
(for the default service) and admin
(for the admin service) and both are working just fine
I have also this record CNAME * ghs.googlehosted.com
3- I've added these records below in the dispatch.xml:
<dispatch>
<!-- Send all Mobile traffic to the API. -->
<url>api.mydomain.app/*</url>
<module>api</module>
</dispatch>
<dispatch>
<!-- Send all Admin traffic to the Admin Platform. -->
<url>admin.harmonica.app/*</url>
<module>admin</module>
</dispatch>
4- the module name for this backend is defined in appengine-web.xml
as api
5- this is the definition of my API class
@Api(name = "myApi", version = "v1", authenticators = { Authenticator.class },
// scopes = { Constants.EMAIL_SCOPE },
clientIds = { Constants.WEB_CLIENT_ID,
Constants.ANDROID_CLIENT_ID }, description = "API for Harmonica Backend application.")
public class MyApi {...}
6- this is how I define the EndpointsServlet in web.xml
<servlet-mapping>
<servlet-name>EndpointsServlet</servlet-name>
<url-pattern>/_ah/api/*</url-pattern>
</servlet-mapping>
so after doing all of that whenever I try to access https://api.mydomain.app/myApi/v1/path
or https://api.mydomain.app/path
it shows me this response:
Error: Not Found
The requested URL /dating was not found on this server.
and in the server logs I see this No handlers matched this URL.
So can you plz help me out? did I miss out anything ?
Thanks in advance!
I've modified the url-pattern of EndpointsServlet to be:
<servlet-mapping>
<servlet-name>EndpointsServlet</servlet-name>
<!-- This is for accessing the API by the domain name -->
<url-pattern>/*</url-pattern>
<!-- This is for the backward compatibility -->
<url-pattern>/_ah/api/*</url-pattern>
</servlet-mapping>
and now I can access my API from my custom domain.