HAProxy community

Need to see client IP in HAProxy logs


#1

Hello,

I have in my config
option http-server-close
option forwardfor
http-request set-header X-Client-IP %[src]

The logs are showing the IP address of a frontward facing load balancer, not the x-forwarded client IP. How can I make it show the true client IP in the connection logs?


#3

What type of load-balancer is in front of HAProxy?

Is it one that perhaps implements the PROXY protocol?


However, assuming that you can’t update the configuration of the upstream load-balancer, you can use capture request header feature to capture the X-Forwarded-For request header, and thus see them in the logs as described in HTTP log format.


#4

Thank you, that was it.
Added capture request header X-Forwarded-For len 15
into my config.