Forwarded Headers

Injects X-Forwarded-For, X-Forwarded-Proto, and X-Forwarded-Host into upstream requests

Category: Practical
Task: Injects X-Forwarded-For, X-Forwarded-Proto, and X-Forwarded-Host into upstream requests

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

Run it: Use ghcr.io/praxis-proxy/praxis:0.7.2 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.

# Forwarded Headers
#
# Injects X-Forwarded-For, X-Forwarded-Proto, and
# X-Forwarded-Host into upstream requests.
#
# Set use_standard_header: true to also inject the
# RFC 7239 Forwarded header:
#   Forwarded: for=<ip>;proto=<proto>;host=<host>
#
listeners:
  - name: web
    address: "127.0.0.1:8080"
    filter_chains:
      - main

filter_chains:
  - name: main
    filters:
      - filter: forwarded_headers
        trusted_proxies:
          - "10.0.0.0/8"
          - "172.16.0.0/12"
        use_standard_header: true
      - 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