Replace response filter - HTTP

The Replace response filter is an easy way to modify the text in an HTTP response without having to write any code.


URL pattern

Optional. Specifies for which URL(s) the filter should be executed. This does not include the protocol, host and port number. If specified, it can be either:

  • a URL as a string for which this filter should get executed. For instance: /rest/state

  • a regular expression (starting with regex: ) that matches the URL. For instance: regex:/rest/state/[0-9]+


Optional. If specified, the HTTP method (e.g. GET, POST, PUT, etc...) for which this filter should get executed. If not specified, all methods will match.

Client IPs

Optional. If specified, a comma-separated (or line-break separated) list of IP4 or IP6 addresses or regular expressions for IP addresses. If specified, only requests from matching IP addresses will cause the execution of the filter. For example:

  •,, regex:88\.48\.23\.\d{1,3}

  • 0:0:0:0:0:0:0:1, regex:2600:1700:6270:6aa0:51:92ca:\d+:\d+

Header patterns

Optional. If specified, a newline-separated list of header specifications which must match the response's headers. The name of the header is a simple string (case-insensitive), followed by a colon, and a regular expression for the header value. For instance:

Content-type: ((application/json)|(text/json))

If more than one pattern is specified (separated by line breaks), then the filter will be executed if at least one of the patterns matches at least one of the headers in the response.

Status code patterns

Optional. If specified, this filter will be invoked only if the response's HTTP status code matches one of the patterns specified. Examples:

  • 200

  • 200, 201, 202

  • regex:20\d

Search pattern

A string or regular expression to be found in the body of the response. If it is found, all instances will be replaced by the value specified in Replacement string.

This search pattern can be a Java regular expression if it is prefixed by regex: (or REGEX: for case-sensitivity) and can contain capturing groups (surrounded by parentheses), which can then be used in the replacement string.

Replacement string

The value that should replace the text matched by the Search pattern parameter. This is a simple string, but that string can contain special expressions:

  • ${0} will be replaced with the entire value matched by the Search pattern.

  • ${n} where n is 1 and above will be replaced by the corresponding capturing group in the Search pattern.


If the Search pattern parameter is set to:


and the Replacement string parameter is set to:


then a response that contains:

"url": "https://myserver:8099/api/customer/123",

would be returned to the client with:

"url": "https://myotherserver:4565/api/customer/123",