proxy_pass to backend (varnish): delivered ip?

Axel ar at xlrs.de
Wed Jan 30 16:23:05 UTC 2013


Hello,

Am 30.01.2013 17:13, schrieb revirii:

>> varnish could see the "true" remote_addr in the X-Real-IP: http 
>> header
>> that you send, if it looked there.
>
> Hm, would be interesting which param varnish checks. It can't be
> $remote_addr, so it has to be the address nginx proxies to (127.0.01 
> or
> 192.168.0.1). Very strange. So it seems to be a varnish problem? :-/

You can see the right X-Forwarded-For header with tcpdump.

Take a look at the log format varnish uses. I don't know how to 
configure varnish, but with Apache you have to change your LogFormat 
from

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" 
\"%{User-Agent}i\""  combined

to something like

LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b 
\"%{Referer}i\"\"%{User-Agent}i\"" nginx

rgds, Axel

-- 
Never argue with an idiot; people watching may not tell the difference



More information about the nginx mailing list