Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom domain mapping to Google App Engine module or version

Suppose I have a Google App Engine application which has several modules which have several versions. Can I map a custom domain name to a specific version of a specific module of the application?

For example:

http://www.example.com should be mapped to http://module1-dot-app1.appspot.com

like image 531
Korneel Avatar asked Feb 14 '14 12:02

Korneel


2 Answers

1.Mapping a module to custom domain

Let's suppose you are admin for domain example.com and you want to map subdomain www.example.com to module webmodule in your application myapp.appspot.com

www.example.com -> webmodule.myapp.appspot.com

What you can do is going to admin.google.com and in App Engine Apps section configure your application so that it is mapped on web address www.example.com. Of course follow the instruction for configuring your domain (you should add a CNAME entry in your DNS configuration with ALIAS www and HOST ghs.googlehosted.com).

Once you did this, web address www.example.com is linked to your application default module. For redirecting to webmodule you need to configure application internal routing with dispatch file, as reported here:

https://developers.google.com/appengine/docs/python/modules/routing

In your case what you need is something like this (this is from dispatch.yaml file for Python application):

dispatch:

    - url: "www.example.com/*"
      module: webmodule

2.Mapping a version to custom domain

Regarding versions, it seems you cannot map an url to a specific module version. What you can probably do is mapping an url including version to a specific module, but this is maybe little bit confusing.

like image 57
thetonrifles Avatar answered Oct 19 '22 19:10

thetonrifles


As thetonrifles already pointed out, you must use the dispatch.yaml file, which goes in your default module.

However, I also came across some issues when using secure domains/subdomains. If you've already uploaded your SSL cert for your custom domain, and you add custom subdomains after the fact, you need to go back to the SSL cert section and enable those subdomains you added, otherwise they'll just keep showing blank.

like image 45
nickjag Avatar answered Oct 19 '22 19:10

nickjag