The header X-Forwarded-For contains multiple IPs


I'm trying to get de real IP in header X-Forwarded-For. I'm using an external LB from my cloud provider and the LB create these three headers:


Traefik service is running on nodePort, and externalTraffic is set to Local.

When The request is forwarded by traefik to the pod, I can see these headers:

* x-forwarded-for: "<client ip sent my ext LB>, <internal ip of the LB>",
* x-forwarded-host: "",
* x-forwarded-port: "443",
* x-forwarded-proto: "https",
* x-forwarded-server: "traefik-6zm95",
* x-real-ip: "<internal ip of the LB>"

As we can see, traefik is adding the internal ip of the LB in x-forwarded-for, and create a new header called x-real-ip that contains the bad IP.

How can I configure traefik to not deal at all with these headers as they already have set by the external LB ?

Thanks for your help.

There are some community middlewares available to get the real IP, maybe they can help.