Varnish client IP address not display
Michael Alger
varnish at mm.quex.org
Mon Mar 19 09:00:29 CET 2012
> On Mon, Mar 19, 2012 at 4:36 PM, Jewel Nuruddin wrote:
> > My varnish is run on 10.70.18.22 server and my web server run
> > back end 10.70.18.30
> > When client browse through varnish in my web server it always
> > show varnish IP(10.70.18.22)
> > But I want my web server should display client IP address.
> > I use the following configuration
> Sorry I the configuration is bellow, please ignore my previous
> configuration.
>
> sub vcl_recv {
> remove req.http.X-Forwarded-For;
> set req.http.X-Forwarded-For = client.ip;
>
> }
>
> But still it did not work for me !!!
The above code adds a new header "X-Forwarded-For" which will
contain the IP address of the client, as seen by Varnish. You can
modify the backend server to utilise this header rather than the
address of the connection itself, if you wish to display/store/etc.
the client's IP address. This is fairly easy if you're displaying
this information in your own server-side code (PHP, ASP, etc.).
It may be more difficult or impossible if you're relying on
server-provided environment variables and built-in functionality.
Any information derived from the connection properties will of
course include your Varnish server's IP address, since that's the
system which is connecting to the backend.
More information about the varnish-misc
mailing list