If internet traffic comes through an HAproxy load balancer on SSL and that is passed to an nginx web server, how can I log the clients ip address?

I'm aware of methods like this: How can I use HAproxy with SSL and get X-Forwarded-For headers AND tell PHP that SSL is in use? where you can strip the ssl before the request gets to HAproxy.

Is there anyway to log the clients ip address without stripping the ssl before HAproxy?

I'm using option httpclose and option forwardfor for http connections. Is there an equivalent to this for tcp connections?


If you don't want to use X-Forwarded-For header and terminate SSL on HAProxy (or before it), but instead you want to terminate SSL on back-end servers - then there should be at least 2 solutions that provide client IP on back-end:

1) Use Proxy protocol on HAProxy (haven't tried it yet)

2) Use LVS with Direct Routing

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.