Azure API 管理中的重定向策略
Redirect policy in Azure API Management
Azure API 管理 (Azure APIM) 是否提供重定向 URL 的任何方式,以便复制 Apigee RedirectToLoginPage 功能
在撰写本文时,Azure APIM 级别不支持此功能。由于我将 IdentityServer 用于 Oauth2 安全性,因此我通过编写一个 owin/katana 身份验证中间件来实现这一点。安德斯·亚伯 post about it.
您可以在全局(所有 API)范围内设置策略。
<choose>
<when condition="@(!context.Request.OriginalUrl.Host.Contains("redirect.com"))">
<return-response>
<set-status code="303" reason="See Other" />
<set-header name="Location" exists-action="override">
<value>@("https://redirect.com/" + context.Request.OriginalUrl.Path + context.Request.OriginalUrl.QueryString)</value>
</set-header>
</return-response>
</when>
</choose>
Azure API 管理 (Azure APIM) 是否提供重定向 URL 的任何方式,以便复制 Apigee RedirectToLoginPage 功能
在撰写本文时,Azure APIM 级别不支持此功能。由于我将 IdentityServer 用于 Oauth2 安全性,因此我通过编写一个 owin/katana 身份验证中间件来实现这一点。安德斯·亚伯 post about it.
您可以在全局(所有 API)范围内设置策略。
<choose>
<when condition="@(!context.Request.OriginalUrl.Host.Contains("redirect.com"))">
<return-response>
<set-status code="303" reason="See Other" />
<set-header name="Location" exists-action="override">
<value>@("https://redirect.com/" + context.Request.OriginalUrl.Path + context.Request.OriginalUrl.QueryString)</value>
</set-header>
</return-response>
</when>
</choose>