In my python application, browser sends a request to my server to fetch certain information. I need to track the IP of the source from where the request was made.Normally, I am able to fetch that info by this call :
request.headers.get('Remote-Addr')
But, when I deploy the application behind a load balancer like HaProxy, the IP given is that of the load balancer and not the browser's.
How do I obtain the IP of the browser at my server when it's behind a load balancer?
Another problem with my case is that I am using TCP connection from browser to my server via HAProxy and not using http.
I had this issue with AWS ELB and Apache.  The solution was mod_rpaf, which reads the X-Forwarded-For header and replaces it into the standard ip header.
You should check that haproxy is setting the X-Forwarded-For header (which contains the real client IP). You can use modrpaf or another technique to read the real IP.
How to track IP of the browser when there is a load balancer in the middle