Real IP and Host Header

Could anybody help me on how to pass the real IP address and host header in Traefik please? I have a file provider that proxies connects to my Open Media Vault Control Panel but the logs still report that Traefik's IP address are the one contacting it rather than the IP from the originating source.

Hello @DanW

thanks for using Traefik and asking the question.

I would recommend you to see the following docs:

Then the real IP address should be available in the X-Forwarded header.

If you deploy Traefik on Kubernetes with service type Loadbalancer, the externalTrafficPolicy should be also updated.

Thank you

Hi @jakubhajek thank you so much for your response! So does traffic pass the X-Forwarded header by default and it is just a matter of getting Traefik to trust the forwarded headers then?

Hello @DanW

The header X-Forwarded-for is being passed by default. However, in order to get a real IP address, the trust headers mechanism has to be configured.

For testing purposes, it can be set in insecure mode.

Thank you,

why can't traefik have a way to easily get the real ip of user? Every other software/website i use in the world does this or is this a rocket science to implement?

As a reverse proxy, i think it is safe to say most people want this. So why have us waste so much time and energy for something that is widely needed??????

We have to drill into forwarded headers to figure this out ourselves? cloudflare for example passes this as response header with Cf-Connecting-Ip and am sure others have a way of passing this, so why can't traefik implement this that makes sense to be on traefik layer?

1 Like