![](/img/trans.png)
[英]Calling IdentityServer4 from application behind a HAProxy LoadBalancer
[英]Hiding IdentityServer4 behind Ocelot gateway
我正在嘗試通過將其分成較小的部分來解決一個較大的問題。 第一個問題是我不知道如何正確隱藏。 出於本文的目的,我創建了一個簡單的演示應用程序,該應用程序已部署到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)訪問該頁面時,該頁面可以正常工作。
您可能已經找到了答案,但僅適用於子孫后代。 我想問題出在您的所有東西上,它希望將類似/identity/something
傳遞給/something
。
要顯示快速入門頁面,您應該定義另一個重新路由,該重新路由僅捕獲/identity
並轉發到/
。 然后,沒有something
是必需的,重新路由應該只是罰款。
另外,該方案最好是https
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.