Traefik logs ClientAddr

Hello everyone, I am using cloudflare tunnel in host mode. In traffic, I'm trying to get a real ip in access logs, but it gives me an internal docker ip.

tunnel docker-compose.yml
services:
  cloudflared:
    container_name: "cloudflared"
    image: "cloudflare/cloudflared:latest"
    restart: unless-stopped
    environment:
      TUNNEL_TOKEN: ${TUNNEL_TOKEN}
    network_mode: host
    command: [ "tunnel", "--no-autoupdate", "run" ]



In Client Host, request_Cf-Connecting-Ip, request_X-Forwarded-For, request_X-Real-Ip, I get a real ip address


In order for the real ip address to appear in X-Real-Ip, I needed to enable the proxy protocol in the CF zero trust settings

But in order for the logs in the request to be correct, it is necessary that ClientAddr uses a real ip and not a docker network.
Was this page helpful?