0

我试图通过将其拆分为更小的部分来解决更大的问题。第一个问题是我不知道如何正确隐藏。出于这篇文章的目的,我创建了一个简单的演示应用程序,它可以部署到 docker(在github上可用)。它内部有两个微服务:部署到 localhost:7060 的 OcelotGateway(OcelotIdentity 项目)和可部署到 localhost:7050 的 IdentityServer 微服务(Identity 项目)。这是我的豹猫配置文件:

{
  "ReRoutes": [
    {
      "DownstreamPathTemplate": "/{route}",
      "UpstreamPathTemplate": "/identity/{route}",
      "UpstreamHttpMethod": [ "Get", "Options", "Post" ],
      "DownstreamScheme": "http",
      "ServiceName": "identity"
    }
  ],
  "GlobalConfiguration": {
    "RequestIdKey": "OcRequestId",
    "AdministrationPath": "/administration"
  }
}

所以我希望在 localhost:7060/identity 看到 IdentityServer 的快速入门页面,但我得到的是 404。当我直接通过身份服务器的 url (localhost:7050) 访问该页面时,该页面运行良好。

4

1 回答 1

0

您可能已经想出了答案,但只是为了后代;我想问题是你的包罗万象,它期望像/identity/something传递给/something.

要显示快速启动页面,您应该定义另一个重新路由,它只捕获/identity并转发到/. 然后,something不需要,重新路由应该可以正常工作。

此外,该方案应该更好https

于 2019-09-05T16:06:59.227 回答