url_rewrite

Rewrites request URLs using regex substitution and query parameter manipulation before the request reaches upstream.
On this page

Rewrites request URLs using regex substitution and query parameter manipulation before the request reaches upstream.

Configuration Notes

Operations are applied in declaration order, allowing complex multi-step transformations.

Configuration

FieldTypeRequiredDescription
operationsOperationConfig[]noOrdered list of rewrite operations to apply.
operations[].regex_replaceanynoRegex-based path replacement.
operations[].strip_query_paramsanynoRemove named query parameters.
operations[].add_query_paramsanynoAppend query parameters.
allow_rewrite_overrideboolnoWhen true, suppresses the duplicate-rewrite validation error if another rewrite filter precedes this one.

Example

filter: url_rewrite
operations:
  - regex_replace:
      pattern: "^/api/v1/(.*)"
      replacement: "/api/v2/$1"
  - strip_query_params:
      - debug
  - add_query_params:
      source: gateway