Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AppEngine subdomains to modules without wildcard mapping

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

My dispatch.yaml looks like this:

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

  - url: "b.my-domain.com/*"
    module: module-b

and I both subdomains added to this app AppEngine custom domains and CNAME setup correctly.

The problem is hitting both a.my-domain.com and b.my-domain.com resolves to default module.

I haven't tried to do top-level wildcard mapping, i.e. *.my-domain.com to this app since I already have other subdomains mapped to another app.

Is this setup even possible at all with AppEngine?

like image 217
alphageek Avatar asked Sep 29 '22 12:09

alphageek


1 Answers

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.

like image 82
Dan Cornilescu Avatar answered Oct 05 '22 01:10

Dan Cornilescu