<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial,helvetica,sans-serif;font-size:10pt"><div><br>It is working perfectly fine now, thanks. <br><br>I was originally using $http_remote_addr since I noticed in the source code that any variable that starts with "http_" will have nginx retireve the variable from the headers_in, and also noticed that remote_addr is reserved to hold the IP of the actual connection which in my case, would naturally return the IP of the load balancer. But it didn't work when the "underscores_in_headers on" flag was not specified in the config file. <br><br>So out of curiosity, if there is any variable in the header that is already reserved by nginx for another purpose, e.g., remote_port, we should use this underscores_in_headers to retrieve it, or did it work simply because the header had a underscore in it (i.e., REMOTE_ADDR) and the headers normally don't have
 underscores and the lack of the flag was causing Nginx to consider REMOTE_ADDR to be an invaluid header and ignore it?<br><br>Thanks for the help,<br>-M<br><br></div><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"><br><div style="font-family: arial,helvetica,sans-serif; font-size: 13px;"><font face="Tahoma" size="2"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Igor Sysoev &lt;is@rambler-co.ru&gt;<br><b><span style="font-weight: bold;">To:</span></b> nginx@sysoev.ru<br><b><span style="font-weight: bold;">Sent:</span></b> Thursday, March 5, 2009 7:29:13 AM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: nginx not setting REMOTE_ADDR properly?<br></font><br>
On Wed, Mar 04, 2009 at 06:52:50PM -0800, Mohammad Kolahdouzan wrote:<br><br>&gt; My nginx is getting requests through a (NetScaler) load balancer, and $remote_addr is returning the load balancer's IP and not the real user's IP (which the load balancer sets as REMOTE_ADDR in the header). Any other attribute I should use to get the real user's IP?<br><br>You should use $http_remote_addr and set:<br><br>&nbsp; server {<br>&nbsp; &nbsp; &nbsp; underscores_in_headers&nbsp; on;<br><br><br><br>-- <br>Igor Sysoev<br><span><a target="_blank" href="http://sysoev.ru/en/">http://sysoev.ru/en/</a></span><br><br></div></div></div><br>



      </body></html>