User documentation
  1. What is redirection.io?
  2. Starter's guide
  3. What are organizations and projects?
  4. Invite new collaborators
  5. User account and preferences
  6. Using traffic logs
  7. Create a rule
  8. Triggers and markers reference
  9. Actions reference
  10. How to bulk-import or export redirection rules?
  11. Managing instances
  12. Project notifications
  13. Project segmentation
  14. How much does it cost?
  15. Can I use redirection.io for free?
  16. About us

Developer documentation
  1. TL;DR; Fast track
  2. Available integrations
  3. nginx module
  4. Apache module
  5. Upsun integration
  6. Clever Cloud integration
  7. Cloudflare Workers integration
  8. Fastly Compute@Edge integration
  9. Vercel Middleware Integration
  10. Using redirection.io with Docker
  11. How fast is it?
  12. Public API

Agent documentation
  1. Installing the agent
  2. Upgrading the agent
  3. Agent command line options
  4. The agent as a reverse proxy
  5. Agent configuration reference
  6. Minimal configuration
  7. Listening for requests
  8. Forwarding requests to the backend
  9. Virtualhosts
  10. Trusted proxies
  11. GeoIP database
  12. Response compression
  13. Performance tweaks
  14. Access logs
  15. Persisting data in a s3 bucket
  16. Monitoring the agent
  17. Using the agent behind a HTTPS proxy
  18. Agent configuration examples

Managed instances
  1. What are managed instances?
  2. Add a domain to your project
  3. Managed instances limits and quota
  4. Frequently asked questions

Crawler
  1. What is the redirection.io crawler?
  2. Start a crawl
  3. Schedule a crawl
  4. Analyzing the results of a crawl
  5. The crawls list
  6. Crawl credits and pricing
  7. Crawl Errors
  8. Crawler metrics reference
  9. Crawler columns reference

Knowledge base
  1. Create your first redirections
  2. redirection.io rules cookbook
  3. Setting up a redirection server on Azure Cloud
  4. Structured data and Rich Snippets
  5. What is a URL redirection?
  6. Why use URL redirections and how to setup

Legacy versions
  1. Agent 1.x configuration reference
  2. Agent 2.x configuration reference
  3. Legacy integrations
  4. Legacy Cloudflare Workers integration

Changelogs
  1. redirectionio-agent
  2. libnginx-mod-redirectionio
  3. libapache2-mod-redirectionio

Trusted proxies

When the redirection.io agent is used as a reverse proxy, it is usually deployed in front of one or more backend servers. It may also be deployed behind a load balancer or a CDN. In these cases, the agent needs to be configured to trust the proxies that are forwarding the requests to it, in order to correctly identify the client's IP address and other information that may be lost when the request is forwarded to the agent.

The trusted_proxies configuration node allows you to fine-tune the trusted proxies behavior:

  • list the IP addresses of the proxies that you want to trust
  • specify whether or not to individually trust the Forwarded, X-Forwarded-For, X-Forwarded-Proto and X-Forwarded-Host headers sent by the proxies, which are commonly used to forward the client's IP address and other information

Default behavior

When the trusted_proxies node is not defined, the agent applies the following defaults:

  • all the private IP addresses are trusted: loopback addresses, link-local addresses, and the private ranges defined by RFC 1918 (10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16)
  • the Forwarded and X-Forwarded-For headers sent by these proxies are trusted
  • the X-Forwarded-Proto and X-Forwarded-Host headers are not trusted

The two last headers must be enabled explicitly, for a good reason: trusting them means letting the caller decide which scheme and which domain name are used to match rules and to record logs. Enable them only when the proxy running in front of the agent always sets them, and always overwrites the value that a client could have sent.

Note that the ips directive is optional: if you do not define it, the private IP addresses listed above are trusted. This is convenient when the agent runs in a container or in an orchestrator, where the address of the proxy in front of it is not known in advance.

Running the agent behind a TLS termination proxy

It is very common to run the agent behind a load balancer, a CDN, or another reverse proxy (HAProxy, Varnish, nginx, Envoy, Traefik, an AWS load balancer, Cloudflare, etc.) which terminates the TLS connection and forwards the requests to the agent as plain HTTP requests.

In such a setup, and as long as the agent does not trust the X-Forwarded-Proto header, these requests are seen as http requests, even though the client actually performed an https request. This has two visible consequences:

  • requests are logged with the http scheme in the redirection.io manager
  • rules using triggers with absolute URLs (https://example.com/some-page) never match

To get the original scheme back, trust the X-Forwarded-Proto header sent by the TLS termination proxy:

The agent then determines the scheme of the request by reading the Forwarded header first, then the X-Forwarded-Proto header, and finally falls back to the scheme of the connection it received. Requests forwarded in plain HTTP by your TLS termination proxy are then matched and logged as https requests.

The same applies to the domain name, with the X-Forwarded-Host header, when the proxy running in front of the agent rewrites the Host header of the requests.

If the proxy in front of the agent sends none of these headers, you can still force the scheme and the host used for matching, with the override_request_scheme and override_request_host directives. Trusted proxies should nevertheless be preferred whenever possible, as they preserve the real value of each request.

A more detailed example

The trusted_proxies node also allows to restrict the list of trusted proxies, and to disable the headers that you do not want to trust. For example, see the following configuration:

View in configuration explorer
instance:
    name: 'My Instance'
reverse_proxy:
    listen:
        - 'tcp://0.0.0.0:80'
    trusted_proxies:
        ips:
            - 192.168.0.0/16
            - 172.16.0.16
        forwarded: true
        x_forwarded_for: true
        x_forwarded_host: false
        x_forwarded_proto: true
    forward:
        address: 'backend:8080'
    agent:
        project_key: my-project-key

With this configuration, the agent will trust the Forwarded and X-Forwarded-For headers that could be passed by the proxies at the IP addresses 172.16.0.16 or in the CIDR range 192.168.0.0/16. It will also trust the X-Forwarded-Proto header, but not the X-Forwarded-Host header. Requests coming from any other IP address are considered as direct client requests, and all their forwarding headers are ignored.

This page has been updated on Aug 17, 2026
Can't find your answer?