Skip to content

Instantly share code, notes, and snippets.

@papeMK2
Last active March 20, 2023 09:37
Show Gist options
  • Save papeMK2/1a4ecaec472a9498b8dbb87b0c8bce8f to your computer and use it in GitHub Desktop.
Save papeMK2/1a4ecaec472a9498b8dbb87b0c8bce8f to your computer and use it in GitHub Desktop.
If backend return status code 500, redirect to any your url sample.
<policies>
<inbound>
<base />
<set-backend-service id="apim-generated-policy" backend-id="{your backend id}" />
</inbound>
<backend>
<base />
</backend>
<outbound>
<base />
<choose>
<when condition="@(context.Response.StatusCode == 500)">
<set-status code="307" reason="error" />
<set-header name="Location" exists-action="override">
<value>@("{your redirect url}")</value>
</set-header>
</when>
</choose>
</outbound>
<on-error>
<base />
</on-error>
</policies>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment