AppEngine subdomains to modules without wildcard mapping

前端 未结 2 1256
被撕碎了的回忆
被撕碎了的回忆 2020-12-10 18:59

I want to have 2 custom subdomains mapped to different modules of my AppEngine app, i.e.:

a.my-domain.com -> default module
b.my-domain.com -> module-b         


        
相关标签:
2条回答
  • 2020-12-10 19:17

    I managed to get such setup working with Google Apps.

    The confusion I guess came from calling x.my-domain.com subdomains (I had the same problem initially) - they're actually just hosts on the *.my-domain.com domain.

    I have the *.my-domain.com (primary) naked domain handled by Google Apps, redirected to www.my-domain.com - in the Domains menu in the Admin Console.

    I added my App Engine app ID to the App Engine apps menu in the Admin Console. Then clicking on my my app's entry in that menu I created a Web address/new URL for each of the hosts by adding just the a and b with the naked domain (not subdomain!) selected in the dropdown list. Now I see in the Web address list:

    • https://myapp.appspot.com
    • http://a.my-domain.com delete
    • http://b.my-domain.com delete

    WARNING: Careful when entering info at the above step as so far I was unable to remove/correct URLs, I hit exactly the issue described here (and calling support yesterday didn't help so far in my case): App Engine (On Google Apps) Custom Domain can't remove

    In the Security -> SSL for Custom Domains menu in the Admin Console I have the wildcard SSL certificate for my naked domain in one of the 5 SNI slots. I added the 2 URLs now visible in the dropdown box (and in the Unassigned URLs list below) to the SNI-only serving mode.

    I had a bit of trouble with my dispatch file - wasn't uploaded properly by PyCharm since I switched to modules, had to upload it manually (using appcfg.py --oauth2 update_dispatch .) and only after I included my app name in it it became effective (visible in the old GAE Apps console https://appengine.google.com/ as a Main -> Dispatch menu, couldn't yet find an equivalent in the Developer Console):

    application: myapp
    dispatch:
      - url: "a.my-domain.com/*"
        module: default
      - url: "b.my-domain.com/*"
        module: module-b
    

    Note: it may take a while until the DNS changes are propagated (BTW, I aquired my naked domain through Google when I signed up and thus they are able to drive the DNS ops directly, I didn't have to do anything myself) - in my cases the propagation times were in the 5-15 min range.

    Note: it also took a few minutes from the moment I added the URLs to my SSL certificate serving list until the pages started working - during that interval I was getting security warnings (I have secure enforced for all entries in my modules' .yaml files).

    I think that's about it.

    0 讨论(0)
  • 2020-12-10 19:23

    In case you're using Google Apps to configure your domain, it doesn't seem to be possible:

    Applications that use Google App Engine are not available for users at non primary domains[1].

    From "Google App Engine" at https://support.google.com/a/answer/182081

    It's also mentioned at https://cloud.google.com/appengine/docs/ssl:

    Google Apps does not support "secondary" domains for your App Engine app, as explained here. You can still use secondary domains with other apps you offer through Google Apps, but your App Engine app can only be accessed with your account's primary domain or its aliases.

    You should be able to configure your domains without Google Apps, but if you need SSL support, which requires using Google Apps, I think there's no proper solution.

    0 讨论(0)
提交回复
热议问题