URL Rewriting

The URL Rewriting Policy is used to re-write responses from the backend API such as they will be modified by fixing up any incorrect URLs found with modified ones. As the API Management works through an API gateway, in some cases an API might return URLs to followup action or data endpoints. In these cases the backend API will likely be configured to return a URL pointing to the unmanaged API endpoint. This policy can fix up those URL references so that they point to the managed API endpoint instead.

This policy cannot be used for any other replacements besides URLs. The policy is implemented specifically to find and replace valid URLs.

url_rewriting_configuration.png

Configuration Options

Option

Type

Description

Possible Values

Default

Find all URLs matching regular expression
(fromRegex)

String

A regular expression used to identify a matching URL found in the response.

-

-

Replacement

String

The replacement URL. Regular expression groups identified in fromRegex can be used.

-

-

Request URL

Boolean

Set to true if URLs should be replaced in the request body.

true / false

false

Request HTTP headers

Boolean

Set to true if URLs should be replaced in the request headers.

true / false

false

Response HTTP headers

Boolean

Set to true if URLs should be replaced in the response headers.

true / false

false

Response HTTP body

Boolean

Set to true if URLs should be replaced in the response body.

true / false

false


Related Pages: