Examples

Url Rewriting Preserve

Drop every query param except the ones listed (allowlist)

Praxis v0.8.0 1 min read

Category: Practical
Task: Drop every query param except the ones listed (allowlist)

Prerequisites: The product runtime and any backend services referenced by this configuration.

Run it: Use ghcr.io/praxis-proxy/praxis:0.8.0 and follow the first reverse-proxy tutorial to mount and start the configuration.

This configuration comes from the selected release. The example has not been run here; external services are not bundled.

Download the source file.

# URL Rewriting — preserve_query_params_only
#
# Drop every query param except the ones listed (allowlist).
# Unlike strip_query_params (denylist: remove these, keep the rest),
# preserve_query_params_only keeps only what is explicitly listed.
#
# Note: parameter matching is &-delimited only. A backend that also treats ;
# as a separator may see additional parameters inside a retained pair's value.
# This filter is not a security gate for such backends.
#
listeners:
  - name: default
    address: "127.0.0.1:8080"
    filter_chains:
      - main

filter_chains:
  - name: main
    filters:
      - filter: url_rewrite
        operations:
          - preserve_query_params_only:
              - api-version
              - user

      - filter: router
        routes:
          - path_prefix: "/"
            cluster: backend

      - filter: load_balancer
        clusters:
          - name: backend
            endpoints:
              - "127.0.0.1:3000"

insecure_options:
  allow_private_endpoints: true # example proxies to local backends