Why is Traefik showing Cloudflare's IP instead of the real visitor IP when using a tunnel?

Responsive Ad Header

Question

Grade: Education Subject: Support
Why is Traefik showing Cloudflare's IP instead of the real visitor IP when using a tunnel?
Asked by:
90 Viewed 90 Answers

Answer (90)

Best Answer
(367)
This happens because Cloudflare acts as a proxy. By default, Traefik sees Cloudflare's IP. To resolve this, you need to configure Traefik to recognize Cloudflare's IPs as trusted proxies and extract the original IP from the `X-Forwarded-For` header. Without the correct middleware configuration, Traefik will only see the last hop's IP address, which is Cloudflare's.