Redirected custom domain from Google does not show in browser address bar

876 views
Skip to first unread message

Glenn Richard

unread,
Apr 25, 2021, 9:09:30 AM4/25/21
to Google App Engine
I purchased two custom domains from Google, and have redirected them to my App Engine project addresses. I performed the steps of setting up DNS for both. When I enter either of the custom domains into a browser address bar, the redirection does occur, and the page content is displayed in the browser window, however the custom domain names do not remain in the address bar. Instead, the App Engine addresses are displayed. How can I configure these so that the custom domain names remain in the address bar instead? It seems that this should go smoothly, since I am using a Google product to connect to another Google product, making any external verification of ownership unnecessary.

Thanks.

NoCommandLine

unread,
Apr 25, 2021, 3:39:36 PM4/25/21
to Google App Engine
Hi,

>>> and have redirected them to my App Engine project addresses <<<

How did you do this? Did you use the 'Add a Custom Domain' under App Engine > Settings? If you didn't, try that method 

Glenn Richard

unread,
Apr 26, 2021, 4:09:26 AM4/26/21
to Google App Engine
I believe that's what I did originally, but in case I am mistaken, I have tried that again with one of the two purchased Google custom domains. After several steps, the process culminated with "DNS changes can take up to 24 hours to take effect. Your SSL certificate will take several minutes to activate." Accordingly, all of this should work within 24 hours, at which time I will check the redirection process and report the results here.

Thanks.

David (Cloud Platform Support)

unread,
Apr 26, 2021, 2:33:07 PM4/26/21
to Google App Engine

Hello,

After properly following mapping custom domains and waiting for DNS propagation, you should be able to see these domain names within your address bar and it should not redirect you to the appspot.com domain. Please make sure you configure the cname as instructed in the document.

Glenn Richard

unread,
Apr 26, 2021, 6:10:56 PM4/26/21
to Google App Engine
Thanks, David.

I seem to be a bit lost. Thus far, redirection to the appspot address does occur, but the custom domain names are not remaining in the address bar, so I'm trying to configure the cname as instructed in the document. I believe that the instructions to which you are referring are here: Updating DNS records at your domain registrar, and that they are in item 3. Locate the host records section of your domain's configuration page and add each of the DNS records that you retrieved when you mapped your domain to your app.

I'm looking at a page in my appspot project settings where information about my custom domain from Google is displayed.  One of the columns is labelled Record type. The only place where a CNAME is listed is on a row where the www is listed under the Custom domain name column. On that row, the entry in the Record type column is CNAME, and the entry under the Data column is ghs.googlehosted.com. All the other records on the page are either of AAAA type or of A type. Is this the host records section of my domain's configuration page to which instruction 3 refers? If so, should there be additional CNAME information on that page that is missing, or do I need to copy something from that page to a form on some other page in order to complete the configuration for the redirection, so that the custom name remains in the address bar?

Thanks for your help.

Glenn Richard

unread,
Apr 26, 2021, 6:25:51 PM4/26/21
to google-a...@googlegroups.com
Hi David,

So,delving a little more into the problem, if I type the www subdomain of the custom name into the address bar, the custom name does appear there after redirection occurs. This leads me to believe that the problem is that I need to create another CNAME record for the naked domain. Where should that be done?

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/164d5064-672b-4b05-9084-7daad13da04dn%40googlegroups.com.

NoCommandLine

unread,
Apr 26, 2021, 6:38:55 PM4/26/21
to Google App Engine
You need to map both the naked domain and the sub domain. See this StackOverflow response (you can ignore the SSL bit)

Glenn Richard

unread,
Apr 27, 2021, 8:52:55 AM4/27/21
to Google App Engine
Thanks, NoCommandLine, and David for your help. The redirect works correctly now. Following your advice, with assistance from links you provided, I re-performed the mapping process from scratch.

For the benefit of others, I am providing the following summary of the steps that I believe were relevant:
  • At the top of the page, the pull-down menu was used to select the project for which the designated custom domain was to be applied.
  • From the navigation menu in the upper left, I scrolled down to the App Engine submenu in the COMPUTE section, and chose Setting from the list that appeared.
  • I selected the Custom domains tab.
  • From there, I clicked on Add a custom domain, then selected the appropriate custom domain previously purchased from Google from the pull-down menu.
  • I mapped both the naked domain and the www subdomain. For the naked domain, this created four A records and four AAAA records. For the www subdomain, it created one CNAME record. These can be viewed at any time via the Add a custom domain tab.
  • Offline, I edited the app.yaml file for the project to add the following:
- url: /.*
  secure: always
  redirect_http_response_code: 301
  script: auto

  • Back online, I uploaded the revised app.yaml file and redeployed the project.
  • To avoid the hazard of having the cached version of the appspot url from appearing in the address bar, I removed that address from the history in ny browser, which is Google Chrome.
After that, it works, thanks! If any of the above is inaccurate or requires clarification, please advise.




NoCommandLine -

unread,
Apr 27, 2021, 11:36:21 AM4/27/21
to google-a...@googlegroups.com
Looks good. Glad you figured it out.

Note: If for some reason someone goes directly to the .appspot link, it won’t automatically redirect to your custom domain. You need to have code that will handle this redirect. However, some people don’t worry about this based on the argument that the probability of someone going directly to the appspot link is very low because the person would need to know the Application Id, and also know it’s being hosted on GAE.

   ..... NoCommandLine ......
 https://nocommandline.com

A GUI for Google App Engine






You received this message because you are subscribed to a topic in the Google Groups "Google App Engine" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-appengine/FfDF_NwSPqQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-appengi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/d94f7833-5923-45a9-87a4-eb8736166171n%40googlegroups.com.

Glenn Richard

unread,
Apr 27, 2021, 12:59:00 PM4/27/21
to Google App Engine

Thanks for your feedback, NoCommandLine. Personally, it's fine with me if someone finds a way into my site via the appspot domain name, so long as the custom name prevails in the address bar when it is used as the access method. But for those who read this thread and wish to redirect visitors who get to their sites via their appspot domain, where is there documentation that describes how to accomplish this redirect?

NoCommandLine -

unread,
Apr 27, 2021, 1:17:17 PM4/27/21
to 'wokmou' via Google App Engine
I don’t know of specific documentation about this (apart from code suggestions/approaches on Stackoverflow).

On a project which was written in Python (with Flask), we added the code to @app.before_request so it gets executed before each request to the Application (and redirected the user to the custom domain). On another project, we created a separate service (this means we had a dispatch.yaml file) to handle all such urls and returned a 404 error
Reply all
Reply to author
Forward
0 new messages