首页 文章

带有ARR的IdentityServer 4(应用程序请求路由)

提问于
浏览
0

我试图让IdentityServer 4在双节点ARR设置中运行 . 我配置了其他双节点Web应用程序,但IdentityServer不想玩得很好 . 服务器仅设置为HTTPS . 当我在一个站点中使用它时一切都很好,所有请求都是https:// ...但是在ARR设置中,请求开始如下:

https://identityserver.local/.well-known/openid-configuration http:/identityserver.local/connect/authorize?client_id = ....

第二个请求导致404.当我将其作为常规单个站点时,第二个请求是:

HTTPS:/identityserver.local/connect/authorize CLIENT_ID = ....

使用ARR运行时为什么是http而不是https?

1 回答

  • 2

    这一步的解决方案有两个步骤:首先我修复了Forwarded标头:

    services.Configure<ForwardedHeadersOptions>(options =>
    {
        options.ForwardedHeaders = ForwardedHeaders.XForwardedProto;
    });
    

    接下来,配置数据保护,以便加密密钥由应用程序的不同实例共享 .

    services.AddDataProtection()
            .SetApplicationName("MyAspNetCoreSample")
            .PersistKeysToFileSystem(new DirectoryInfo(@"path\to\shared\folder"));
    

    希望这有助于某人 .

相关问题