URL 使用错误的 OWIN OpenIdConnect 重写、ARR 和 SSO AzureAD URL

URL Rewrite, ARR and SSO AzureAD with OWIN OpenIdConnect using wrong URL

我目前正在 DMZ 中的服务器上使用 IIS URL 重写模块和应用程序请求路由,以将请求转发到内部服务器上的 Web 应用程序 运行。

部署在内部服务器上的应用程序具有 SSO,其中包括使用 OWIN 管道和 openIdConnect 的 Azure AD。

当用户选择使用 AzureAD 选项进行身份验证而不是被重定向到 https://login.microsoftonline.com/<tenantname>/... 它们被重定向到 http://my.company.com/<tenantname>/...,其中 http://my.company.com 是用于从 DMZ 访问应用程序的 URL。

SSO 适用于所有内部实例,即在反向代理场景中未转发请求的实例。

为什么在使用 URL 重写和 ARR 时会发生这种情况?

取消选中 Reverse rewrite host in response headers 复选框 Application Request Routing Cache > Server Proxy Settings 解决了这个问题.

Reverse rewrite host in response headers (checked)

ARR will rewrite the host name in the location header of a 301 response to the original host.