使用谷歌云应用引擎将域重定向到另一个域特定的网址



我正在尝试通过将我的域名称服务器设置为另一个域来将其他域重定向到我的域。 前任。 我的域名: example.com 创建的名称服务器:ns1.example.com

其他域: domain.com 设置名称服务器:ns1.example.com

当我打开 domain.com 时,它必须重定向到 example.com/redirected/domain.com

我不知道如何在Google App Engine上做到这一点。 我如何在谷歌应用引擎上使用Spring启动应用程序来实现这一点,或者有什么办法可以做到这一点?

如果您在 App Engine 中同时拥有这两个网域,则可以使用 dispatch.yaml 从一个服务路由到另一个服务。在文档中有一个示例,如中所述:

以下是将请求路由到http://simple-sample.appspot.com和请求,例如http://simple-sample.appspot.com/favicon.ico默认服务。 所有静态内容都由默认服务提供。移动请求 就像http://simple-sample.appspot.com/mobile/被路由到手机一样 前端和工作线程请求,例如http://simple-sample.appspot.com/work/路由到静态后端。

这是配置:

dispatch:
# Default service serves the typical web resources and all static resources.
- url: "*/favicon.ico"
service: default
# Default service serves simple hostname request.
- url: "simple-sample.appspot.com/"
service: default
# Send all mobile traffic to the mobile frontend.
- url: "*/mobile/*"
service: mobile-frontend
# Send all work to the one static backend.
- url: "*/work/*"
service: static-backend

文档中有更多可能的配置和语法说明。同样重要的是不要忘记部署:

gcloud app deploy dispatch.yaml

最新更新