Nginx removes X-Client-IP header added by loadbalancer

mrtn nginx-forum at
Sat Dec 8 18:20:12 UTC 2012


I have a HAProxy running in front of Nginx, and I add 'X-Client-IP' header
to reflect the actual IP of the client. If the request is routed directly to
the application server (Tornado in my case), this header is present and I
can retrieve it with no problem.

However, if the request is first routed to Nginx and then to the application
server using: 

proxy_pass    ;
proxy_redirect          off;

then the 'X-Client-IP' header is missing from the request when it reaches
Tornado. I guess I might need to explicitly add this header in Nginx as
well, so it can relay it on. What is the right solution here?

Posted at Nginx Forum:,233736,233736#msg-233736

More information about the nginx mailing list