path_rewrite
Rewrites the request path before forwarding to the upstream.
On this page
Rewrites the request path before forwarding to the upstream.
Configuration Notes
Supports three operations (one per filter instance): - strip_prefix: remove a leading path prefix - add_prefix: prepend a path prefix - replace: regex find/replace on the path
Query strings are preserved across all operations.
Exactly one of the three operation fields must be set.
Configuration
| Field | Type | Required | Description |
|---|---|---|---|
strip_prefix | string | no | Remove this prefix from the request path. |
add_prefix | string | no | Prepend this prefix to the request path. |
replace | ReplaceConfig | no | Regex find/replace on the request path. |
replace.pattern | string | yes | Regex pattern to match. |
replace.replacement | string | yes | Replacement string (supports $1, $name capture groups). |
allow_rewrite_override | bool | no | When true, suppresses the duplicate-rewrite validation error if another rewrite filter precedes this one. Consumed by pipeline validation via the raw YAML config. |
Example
filter: path_rewrite
strip_prefix: "/api/v1"