Mask URLs in content
APPLIES TO: All API Management tiers
The redirect-content-urls
policy rewrites (masks) links in the response body. Use in the outbound section to rewrite response body links to the backend service to make them point to the gateway instead. For example, you might do this to hide URLs of the original backend service when they appear in the response. Use in the inbound section for an opposite effect.
Note
This policy does not change any header values such as Location
headers. To change header values, use the set-header policy.
Note
Set a policy's elements and child elements in the order provided in the policy statement. Learn more about how to set or edit API Management policies.
Policy statement
<redirect-content-urls />
Usage
- Policy sections: inbound, outbound
- Policy scopes: global, workspace, product, API, operation
- Gateways: classic, consumption, self-hosted
Usage notes
- This policy can only be used once in a policy section.
Example
<redirect-content-urls />
For example, consider the following image, which shows an API response body that includes the original backend service URLs.
After the redirect-content-urls
policy is configured in the outbound section, the response body is rewritten to point to the gateway, in this case, https://apim-hello-world.azure-api.cn
.
Related policies
Next steps
For more information about working with policies, see:
- Tutorial: Transform and protect your API
- Policy reference for a full list of policy statements and their settings
- Policy expressions
- Set or edit policies
- Policy samples