Custom domain mapping to Google App Engine module

2019-04-22 15:24发布

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

2条回答
Evening l夕情丶
2楼-- · 2019-04-22 15:50

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.

查看更多
孤傲高冷的网名
3楼-- · 2019-04-22 15:59

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.

查看更多
登录 后发表回答