HTTP_X_FORWARDED_FOR handling

linuxsupport lin.support at gmail.com
Sat Jan 15 10:55:45 CET 2011


in vcl_recv put following.

remove req.http.X-Forwarded-For;
set    req.http.X-Forwarded-For = client.ip;

Thaks

On Sat, Jan 15, 2011 at 2:01 PM, Frank Helmschrott
<fhelmschrott at gmail.com>wrote:

> Hi,
>
> I'm using varnish-2.1.4 SVN 5447M and wonder how HTTP_X_FORWARDED_FOR
> gets treatened by varnish.
>
> In my VCL (which i partly copied from elsewhere) there are some lines
> that i found in many VCLs around the net:
>
> -- snip --
>
>    # Add a unique header containing the client address
>    remove req.http.X-Forwarded-For;
>    set req.http.X-Forwarded-For = req.http.rlnclientipaddr;
>
> --/snip--
>
> I think this should do what i need: set a HTTP_X_FORWARDED_FOR header
> containing the real client IP-Address and add it to the requests that
> hit the backend. These lines are within sub vcl_recv.
>
> I need the Client IP at the backend for some statistic stuff (ip based
> timeouts).
>
> Unfortunately i don't even get an empty HTTP_X_FORWARDED_FOR header.
> It basically doesn't exist. I tried commenting these lines out and
> also tried client.ip instead of req.http.rlnclientipaddr; as i found
> this somewhere else - i don't know which the correct syntax is.
>
> Is there anything else wrong? Or maybe some switch in my varnish
> version that i need to set to make HTTP_X_FORWARDED_FOR appear for my
> backend?
>
> Thanks for helping
>
> --
> Frank
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> http://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20110115/e598da03/attachment-0003.html>


More information about the varnish-misc mailing list