Azure loadbalancer IP overrides the client IP

8/9/2019

I need to be able to log the source IP address trying accessing to my application. Problem is that I have the current setup:

service load balancer-->kong-->myy application

Kong is very good and automatically adds an "X-Forwarded-for" header to requests coming to my application so that I don't get Kong's IP...but this header only contains the load balancer IP!

What should happen is that in that header there should be the client's IP...is that possible?

-- Phate
azure
kong
kubernetes

1 Answer

8/9/2019

You need to set externalTrafficPolicy: Local in the service definition, this will preserve clients ip.

Reading here and here

-- 4c74356b41
Source: StackOverflow