I have successfully deployed a Google Cloud Endpoints v2 API and a App Engine backend to endpoint-dot-example.appspot.com
and I can see the metrics in the endpoints console.
build.gradle:
endpointsServer {
hostname = "endpoint-dot-example.appspot.com"
}
appengine-web.xml:
<env-variables>
<env-var name="ENDPOINTS_SERVICE_NAME" value="endpoint-dot-example.appspot.com"/>
</env-variables>
web.xml:
<filter>
<filter-name>endpoints-api-controller</filter-name>
<filter-class>com.google.api.control.extensions.appengine.GoogleAppEngineControlFilter</filter-class>
<init-param>
<param-name>endpoints.projectId</param-name>
<param-value>example</param-value>
</init-param>
<init-param>
<param-name>endpoints.serviceName</param-name>
<param-value>endpoint-dot-example.appspot.com</param-value>
</init-param>
</filter>
I now wish to serve this API from a custom domain.
For that I have routed a URL api.example.com
to example.appspot.com
at my registra and changed the hostname in build.gradle:
endpointsServer {
hostname = "api.example.com"
}
But I am getting 404 error when making requests with the custom domain. I can also see the logs in the stackdriver logging for the default service. How can I tell app engine to route the requests to the API?
Edit 1 This is the 404 response body:
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>404 NOT_FOUND</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: NOT_FOUND</h1>
</body>