适用于特定版本的Google App Engine自定义子域映射
By default, specific versions of an App Engine app are routed by URLs like https://[VERSION_ID]-dot-[SERVICE_ID]-dot-[MY_PROJECT_ID].appspot.com
.
是否可以通过自定义域获得类似的东西?
Is there any way to have something similar with a custom domain?
我目前为我的应用配置了一个子域映射,该映射配置了指向ghs.googlehosted.com
的CNAME DNS记录(App Engine不提供我的裸"域).这允许从该子域提供我的应用程序的默认版本,但我也希望能够使用我的域来测试应用程序的新版本(出于各种原因,例如共享cookie等)
I currently have a subdomain mapping for my app configured with a CNAME DNS record pointing to ghs.googlehosted.com
(my "naked" domain is not served by App Engine). This allows serving the default version of my app from that subdomain, but I also want to be able to test new versions of the app using my domain (for various reasons such as sharing cookies, etc.)
例如,假设我的域为typeracer.com
,而我在App Engine中的自定义域映射为data.typeracer.com
:我希望能够通过https://[VERSION_ID].data.typeracer.com
这样的URL访问应用程序的特定版本.有什么办法吗?
For example, let's say my domain is typeracer.com
and my custom domain mapping in App Engine is data.typeracer.com
: I want to be able to access a specific version of my app at a URL like https://[VERSION_ID].data.typeracer.com
. Is there any way to do this?
我查看了App Engine文档,以添加分发. yaml .但是,这似乎仅适用于路由应用程序的特定服务,而不适用于应用程序的特定版本.
I've looked at the App Engine docs for adding wildcard subdomain mappings and using a dispatch.yaml. However, it looks like that would work only for routing specific services, but not specific versions of the app.
否,由于映射是每个GAE服务的(子)域,您无法确切请求,您无法选择服务的特定版本在自定义域设置屏幕中.
No, what you ask for exactly is not possible as the mapping is a (sub)domain per GAE service one, you cannot select a certain version of a service in the custom domain settings screen.
类似的声音可能试图基于服务版本实施不同的环境(例如分段),这有一些缺点,请参见
Sounds like may be attempting to implement different environments (say staging) based on service versions, which has some disadvantage, see Continuous integration/deployment/delivery on Google App Engine, too risky?
如果是这样,您可以尝试使用其他服务来实现它们,
If so you can try to implement them using different services instead, which:
- 将允许您为每个环境映射一个(子)域
- 您将避免上述问题与解答"中提到的所有缺点
您提到的域命名方案建议使用可变嵌套级别,这本身可能是有问题的,请参见
The domain naming scheme you mentioned suggests variable nesting levels, which in itself can be problematic, see Sub domain not listed in Google App Engine while enabling SSL for custom domains. Maybe try something like https://data-[VERSION_ID].typeracer.com
instead of https://[VERSION_ID].data.typeracer.com
?