gpt4 book ai didi

google-app-engine - 将自定义子域映射到 App Engine 上的特定版本

转载 作者:行者123 更新时间:2023-12-04 15:54:15 25 4
gpt4 key购买 nike

此页面 ( https://cloud.google.com/appengine/docs/standard/nodejs/mapping-custom-domains ) 说明:

Using subdomains

If you set up a wildcard subdomain mapping for your custom domain, then your application serves requests for any matching subdomain.

  • If the user browses a domain that matches an application version name or service name, the application serves that version.
  • If the user browses a domain that matches a service name, the application serves that service.


此外,此页面 ( https://cloud.google.com/appengine/docs/standard/java/how-requests-are-routed ) 指出:

Sends a request to an available instance of a specific version in the default service:

https://[VERSION_ID]-dot-[MY_PROJECT_ID].appspot.com

http://[VERSION_ID].[MY_CUSTOM_DOMAIN]



我的 App Engine 项目有以下服务:

enter image description here

以及此服务的以下版本:

enter image description here
"1"是默认版本。 "test1"是测试版。

然而当我输入 https://test1.mycustomdomain.com进入浏览器,它提供默认版本,而不是 "test1"版本。

如果我输入 https://test99.mycustomdomain.com进入浏览器,我看到一个错误页面,因为这个版本不存在(正如预期的那样)。

网址, https://test1-dot-MY_PROJECT_ID.appspot.com/按预期工作(即提供 "test1" 版本)。

这些是我配置的域:

enter image description here

如何让 App Engine 将请求路由到正确的版本?

最佳答案

任何直接映射到您的应用程序的域都将提供默认服务。如 test1.mycustomdomain.com映射为自定义域,它将始终提供 1 (默认)。

要使用自定义域提供命名的 GAE 版本,您需要使用通配符 ( *.mycustomdomain.com ) 映射域并删除与您的版本冲突的其他映射子域。工作映射域的一个例子是:

  • mycustomdomain.com
  • www.mycustomdomain.com
  • *.mycustomdomain.com

  • 使用该设置, test1.mycustomdomain.com应该提供正确的版本, test1 .

    编辑

    关于通配符映射和 HTTPS

    GCP documentation about wildcard mapping指出:

    Note: Wildcard mappings are not supported for managed SSL certificates.



    这可能会导致相信通配符映射不支持 HTTPS。该文档指的是 managed certificates that GAE provides . App Engine 确实 support SSL certificates for wildcards如果您使用自己的 SSL 证书:

    Some App Engine features use special subdomains. For example, an application can use subdomains to address application services, or to address different versions of your application. To use these with SSL, it makes sense to set up a SAN or wildcard certificate. Wildcard certificates only support one level of subdomain.

    关于google-app-engine - 将自定义子域映射到 App Engine 上的特定版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52593330/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com