Http Transformation

path_rewrite

Rewrites the request path before forwarding to the upstream.

Praxis v0.8.0 1 min read
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

FieldTypeRequiredDescription
strip_prefixstringnoRemove this prefix from the request path.
add_prefixstringnoPrepend this prefix to the request path.
replaceReplaceConfignoRegex find/replace on the request path.
replace.patternstringyesRegex pattern to match.
replace.replacementstringyesReplacement string (supports $1, $name capture groups).
allow_rewrite_overrideboolnoWhen 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"