Response Rewrite Configuration
Configuration reference for the Response Rewrite plugin (`response-rewrite`): the parameters, each attribute with its type, whether it is required, its default and its accepted values.
Parameters
See plugin common configurations (opens in Apache APISIX docs) for configuration options available to all plugins.
status_code — integer · optional · since APISIX 1.2 · API7 Gateway 3.5.0
Valid values: between 200 and 598 inclusive
New HTTP status code in the response.
body — string · optional · since APISIX 1.2 · API7 Gateway 3.5.0
New response body. The Content-Length header would also be reset. Should not be configured with filters.
body_base64 — boolean · optional · default: false · since APISIX 1.2 · API7 Gateway 3.5.0
If true, decode the response body configured in body before sending to client, which is useful for image and protobuf decoding. Note that this configuration cannot be used to decode upstream response.
headers — object · optional · since APISIX 1.2 · API7 Gateway 3.5.0
Actions to be executed in the order of add, remove, and set.
add — array[string] · optional · since APISIX 2.99.0 · API7 Gateway 3.5.0
Headers to append to responses. If a header is already present in the response, the header value will be appended. Header value could be set to a constant, or one or more built-in variables (opens in Apache APISIX docs).
set — object · optional · since APISIX 2.99.0 · API7 Gateway 3.5.0
Headers to set in responses. If a header is already present in the response, the header value will be overwritten. Header value could be set to a constant, or one or more built-in variables (opens in Apache APISIX docs).
remove — array[string] · optional · since APISIX 2.99.0 · API7 Gateway 3.5.0
Headers to remove from responses.
vars — array[array] · optional · since APISIX 2.5 · API7 Gateway 3.5.0
An array of one or more matching conditions in the form of APISIX expressions (opens in Apache APISIX docs) to conditionally execute the plugin.
filters — array[object] · optional · since APISIX 2.14.1 · API7 Gateway 3.5.0
List of filters that modify the response body by replacing one specified string with another. Should not be configured with body.
regex — string · required · since APISIX 2.14.1 · API7 Gateway 3.5.0
RegEx pattern to match on the response body.
scope — string · optional · default: once · since APISIX 2.14.1 · API7 Gateway 3.5.0
Valid values: once or global
Scope of substitution. once substitutes the first matched instance and global substitutes globally.
replace — string · required · since APISIX 2.14.1 · API7 Gateway 3.5.0
Content to substitute with.
options — string · optional · default: jo · since APISIX 2.14.1 · API7 Gateway 3.5.0
RegEx options to control how the match operation should be performed. See Lua NGINX module for the available options.
max_resp_body_size — integer · optional · default: 67108864 · since APISIX 3.18.0 · API7 Gateway 3.9.17
Valid values: greater than or equal to 1
Maximum response body size in bytes buffered when filters are configured. A larger response is truncated to this size before the filters run. The chunk that crosses the threshold is buffered before the limit is enforced, so transient memory use can exceed the configured size. This field has no effect when filters is not configured. Introduced in API7 Enterprise 3.9.17 and 3.10.4, and APISIX 3.18.0.