GCP Point Custom Domain to Specific App Engine Service

陌路散爱 提交于 2020-01-03 12:47:40

问题


I currently have an Google App Engine Flexible project with four services. And when I map my custom domain to my project using the documentation https://cloud.google.com/appengine/docs/standard/python/mapping-custom-domains, it automatically points to the default service which is not the frontend application. How do I map it to a different service.


回答1:


You cannot map a certain (sub)domain to a certain service in the app-level custom domain mapping, mapping is done only at the app level (as a whole).

To direct a certain (sub)domain to a certain service inside your app you'll need to use a dispatch file, for example:

dispatch:
  - url: "example.com/*"
    module: <frontend-service-name>

Side note: you may want to revisit the decision of handling the frontend in a non-default service: the frontend is IMHO best suited to handle any garbage request coming in (which would typically not match any routing rule and would thus be directed towards the default service). If your default service does something more sensitive than the frontend it might not like that spam coming in.




回答2:


The answer from @dan isn't up to date anymore:

The naming of the dispatch.yaml file changed from 'module' to 'service', like this:

dispatch:
   - url: "sub1.yourdomain.com/*"
     service: web-app

You deploy the stand-alone-file via this command (it hasn't to be in a project folder):

gcloud app deploy dispatch.yaml

Reference: https://cloud.google.com/appengine/docs/standard/python/config/dispatchref



来源:https://stackoverflow.com/questions/47165190/gcp-point-custom-domain-to-specific-app-engine-service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!