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

   ..... NoCommandLine ......
 https://nocommandline.com <https://nocommandline.com/>

A GUI for Google App Engine






> On Apr 27, 2021, at 9:58 AM, Glenn Richard <java...@gmail.com> wrote:
> 
> 
> 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?
> On Tuesday, April 27, 2021 at 11:36:21 AM UTC-4 NoCommandLine wrote:
> 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 <https://nocommandline.com/>
> 
> A GUI for Google App Engine
> 
> 
> 
> 
> 
> 
> 
>> On Apr 27, 2021, at 5:52 AM, Glenn Richard <jav...@gmail.com 
>> <applewebdata://9D27C050-F619-4C2F-8719-871A3C77939D>> wrote:
>> 
> 
>> 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.
>> 
>> 
>> 
>> 
>> On Monday, April 26, 2021 at 6:38:55 PM UTC-4 NoCommandLine wrote:
>> You need to map both the naked domain and the sub domain. See this 
>> StackOverflow <https://stackoverflow.com/a/66268646/15211203> response (you 
>> can ignore the SSL bit)
>> 
>> On Monday, April 26, 2021 at 3:25:51 PM UTC-7 Glenn Richard wrote:
>> 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?
>> 
>> On Mon, Apr 26, 2021 at 2:33 PM 'David (Cloud Platform Support)' via Google 
>> App Engine <google-a...@ <>googlegroups.com <http://googlegroups.com/>> 
>> wrote:
>> Hello,
>> 
>> After properly following mapping custom domains 
>> <https://cloud.google.com/appengine/docs/standard/python/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 <http://appspot.com/> domain. Please make sure you configure the 
>> cname as instructed in the document.
>> 
>> On Monday, April 26, 2021 at 4:09:26 AM UTC-4 Glenn Richard wrote:
>> 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.
>> 
>> On Sunday, April 25, 2021 at 3:39:36 PM UTC-4 NoCommandLine wrote:
>> 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 
>> 
>> On Sunday, April 25, 2021 at 6:09:30 AM UTC-7 Glenn Richard wrote:
>> 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.
>> 
>> -- 
>> 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 <http://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
>>  
>> <https://groups.google.com/d/msgid/google-appengine/164d5064-672b-4b05-9084-7daad13da04dn%40googlegroups.com?utm_medium=email&utm_source=footer>.
>> 
>> -- 
> 
>> 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 
>> <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 
>> <applewebdata://9D27C050-F619-4C2F-8719-871A3C77939D>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/google-appengine/d94f7833-5923-45a9-87a4-eb8736166171n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/google-appengine/d94f7833-5923-45a9-87a4-eb8736166171n%40googlegroups.com?utm_medium=email&utm_source=footer>.
> 
> 
> -- 
> 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 
> <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-appengine+unsubscr...@googlegroups.com 
> <mailto:google-appengine+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/google-appengine/3a420cd0-cd67-43fc-8c66-26ce05e49738n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/google-appengine/3a420cd0-cd67-43fc-8c66-26ce05e49738n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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-appengine+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/35909A15-7937-47AB-97BF-DC689A866EE0%40gmail.com.

Reply via email to