App Engine with subdomains displaying IPs rather than content - google-app-engine

I have configured the App Engine to use a custom domain that I have on CloudFlare. I added the TXT record for verification and all the A and AAAA entries with the given IP addresses.
I have also added 2 CNAME entries that matches the name of 2 services that I have deployed (web and api). I have done this on App Engine settings and in the CloudFlare dashboard.
When I try to go to web.mydomain.com or api.mydomain.com on both cases rather than seeing the content I receive a text response showing a list of IP addresses, and the content served by the Google Frontend (according to the response headers).
Is there any additional configuration I need to do for this to work?
Both services works fine if I access them using the default domain provided by Google (appspot.com)
Thanks!

It turned out that I had to deploy the dispatch.yml file in order for this to work
dispatch:
- url: "api.mydomain.com/*"
service: api
- url: "web.mydomain.com/*"
service: web

Related

How to configure custom domain for App Engine for service that is not the defautl in GCP?

I have one Node aplication runing on default App Engine service. Its was runing on "urlFromWebSite.appspot.com", and I config it to run in my domain url "customUrl.ai".
I built a second service with Node with name "second-service",and its runing at
"service-two-doturlFromWebSite.appspot.com", but i want to run at "subDomain.customUrl.ai"
I tried dispatch.yaml file with the url that i want for 'second-service';
Stack post 1 talking about dipatch
Stack post 1 talking about dipatch
GCP explanation for dispatch
I have tried Custom domains in App Engine > Settings > Custom domains;
GCP documentation for mapping custom domains
At custom domains I config my subdomain url, and it generates the DNS. ´
I have question here:
Where should I add this DNS config? At the "customUrl" or should i create a new record set for it?
I have been strugling with it for 2 days already, and could figure it out how to solve it. How should i config this to change my second service's url for a custom subdomain?
When user enters customUrl.ai in a browser, traffic should be routed to Google's servers (for your GAE project). To do that, you configure DNS settings on your domain registrar's end.
When user enters subDomain.customUrl.ai in a browser, traffic should be routed to Google's servers. To do that, you also configure DNS settings on your domain registrar's end.
Both #1 & #2 are done for the same domain on your domain registrar's end (which is GoDaddy in your case). I believe this is what #JohnHanley is referring to. Put another way - just go to GoDaddy, find your domain and create entries corresponding to what GAE has outlined for you. If they are duplicates, GoDaddy will tell you.

Google App Engine Wildcard Subdomains

I have Node JS app running on google app engine.
I have linked a custom domain to it: www.singlelisting.co
BUT
I need wildcard subdomains to also link to the node application
For Example: 6.singlelisting.co or ns324.singlelisting.co
I have not had much luck reading the documentation on google developers site
I am using cloudflare for DNS management and have added * records for all the google A and AAAA records. I believe the problem is have google is seeing the subdomains. Any help would be greatly appreciated
You have two options:
Mapping subdomains: in your App Engine Custom domains config you need to add the following entry *.singlelisting.co and then update the DSN management with the required records (as you probably did). This means that requests through 6.singlelisting.co or ns324.singlelisting.co will be handled by the 6, respectively ns324 service of you App Engine deployment, if available. As the documentation states:
If you set up a wildcard subdomain mapping for your custom domain, then your application serves requests for any subdomain that matches:
.If the user browses a domain that matches a service name, the application serves that service.
By using a dispatch file (more info here): this file will override the routing rules established (or not) through your domains config.
So basically if you do not have services named 6 and ns324 that will automatically handle requests incoming through the wildcard rule *.singlelisting.co, you have to describe the routing using the dispatch.yaml.

How do I assign the same domain name to 2 App Engine Instances?

I have multiple small to medium sized projects all hosted under my current Rackspace server at apps.foo.com. I would like to move these to an Google App Engine Instance & though I have managed to move a few over, I tend to keep hitting the 10,000 file limit.
Hence I've decided to go with 2 separate App Engine instances though I would like the same domain name to point to them with a setup like apps.foo.com/m1 and apps.foo.com/m2, How can I do this?
I've already migrated the domain name to one instance though I can't figure out how to add another. Please help!
You can't map the same domain to 2 different GAE apps - GAE wouldn't know to which one of the 2 apps hypothetically mapped to the same domain to route an incoming request for the domain.
The request path following the domain is not part of the domain, it is only parsed (following the destination app's parsing rules) after GAE has already selected the destination app based on the request domain.
You might be interested in my recent reply to this Q&A related to reaching deployment quota: Getting error on GAE: Max number of files and blobs is 10000
You can use dispatch to reroute requests to the relevant service.
Deploy your API & WebApp to the same project but as separate services (using the service attribute in the app.yaml file).
Deploy the dispatch
dispatch.yaml
- url: "project-name.appspot.com/api/*"
service: api-service
- url: "project-name.appspot.com/*"
service: web-client-service
For my WebApp's index.html I added also:
<base href="https://project-name.appspot.com/">

Google App Engine module and custom domain

I'm trying to assign custom domain to App Engine module. At the moment I have staging.example.com pointed to app-id.appspot.com and that works correctly but I also want to assign api.staging.example.com to api.app-id.appspot.com. I've created CNAME record from api.staging.example.com to ghs.googlehosted.com, added api.staging.domain.com in developers console/appengine/settings/custom domains and here is my dispatch.yaml:
dispatch:
- url: "staging.example.com/*"
module: default
- url: "api.staging.example.com/*"
module: api
Any ideas what could be wrong? Every request to endpoints on api.staging.example.com shows only 404 error and I can't see this in the logs, it looks like api.staging.example.com is pointed to somewhere else, all request to api-app-id.appspot.com works correctly.
Are you making HTTPS requests? The official docs note that double-wildcard domains are not supported for SSL certificates.
Google recommends using the HTTPS protocol to send requests to your app. Google does not issue SSL certificates for double-wildcard domains hosted at appspot.com. Therefore with HTTPS you must use the string "-dot-" instead of "." to separate subdomains
So you'll need to replace the first . with -dot- to follow this pattern:
https://module-dot-app-id.appspot.com. In your case api-dot-app-id.appspot.com.
OK, I know where is my problem - Google Cloud Endpoints.
Google Cloud Endpoints does not support custom domains.
https://cloud.google.com/appengine/docs/python/endpoints/
https://code.google.com/p/googleappengine/issues/detail?id=9384

What is the mechanism of the `ghs.google.com` domain?

If I want to bind a domain name to my app on the GAE (Google App Engine), I should add a CNAME record to ghs.google.com. I'd like to understand how this domain works.
For example, I have a CNAME like this: blog.goace.com → ghs.google.com, and my app's URL is ace.appspot.com. When I type http://blog.goace.com in my browser, what will happen before I see my Gapp on the screen?
Your browser sends a request to Google's server with the Host: yoursite.com header.
Google looks up this hostname in a (very large) database mapping hostnames to websites, then serves the corresponding website.
This database includes App Engine apps, Google Apps aliases, BlogSpot blogs, and other things.

Resources