【问题标题】:Redirecting domain to another domains specific url using google cloud app engine使用谷歌云应用引擎将域重定向到另一个域特定的 url
【发布时间】:2020-05-18 09:36:56
【问题描述】:

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

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

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

我不知道如何在 Google App Engine 上执行此操作。 我如何在 Google App 引擎上使用 Spring Boot 应用程序来实现这一点,或者有什么方法可以做到这一点?

【问题讨论】:

    标签: java spring .htaccess google-app-engine


    【解决方案1】:

    如果您在 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
    

    【讨论】:

    • 好的,但它可以在域上工作。因为有一个域列表。有域想要重定向到 mydomains 特定的 url
    • 此配置将流量重定向到 App Engine 服务。如果您想专门将其重定向到域,则必须在代码中完成。我找到了另一个解释它的stackoverflow线程stackoverflow.com/questions/1058119/…
    猜你喜欢
    • 2022-08-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-18
    • 2019-04-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多