Pass client IP to proxied requests to remote host

Hello,

having a traefik v3 running as a docker container and need to forward all requests to different host. I'm not able to find a way how to add x-forwarded-for header to the requests

this is my proxy setup:

  routers:
    proxy-secure:
      rule: "Host(`my-host-here`)"
      service: afrodite
      entryPoints:
        - https
      middlewares:
        - removeIdentification
        - compress
      tls:
        certResolver: "mytlschallenge"
  services:
    afrodite:
      loadBalancer:
        servers:
          - url: "https://my-backend-host-here"
        passHostHeader: true

I can see just headers X-Forwarded-Host and X-Forwarded-Server but not x-forwarded-for or any other holding the client IP

Those headers are set by Traefik by default:

X-Forwarded-For: 1.2.3.4
X-Forwarded-Host: example.com
X-Forwarded-Port: 443
X-Forwarded-Proto: https
X-Forwarded-Server: server1
X-Real-Ip: 1.2.3.4

You can test with traefik/whoami.

Hello, You are right. Unfortunately on the target server is another traefik instance before the service and looks like this one (traefik v2) is not reflecting this headers. Anyway I found in doc a way how resolve my situation - by adding trustedIPs into entrypoint config:

   https:
    address: ":443"
    forwardedHeaders:
      trustedIPs:
        - 1.2.3.4

For incoming headers and ProxyProtocol, you need to set the trusted IPs. Otherwise everyone outside could send fake data.