HTTP_X_FORWARDED_FOR handling

Frank Helmschrott fhelmschrott at gmail.com
Sat Jan 15 09:31:22 CET 2011


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




More information about the varnish-misc mailing list