Varnish is not always adding X-Forwarded-For

Paul A. Procacci pprocacci at datapipe.com
Tue Aug 14 01:43:58 CEST 2012


If I'm not mistaken, once you pipe a connection to the backend machines, future requests over
the same socket will be untouched.  To ensure requests always touch the vcl code that adds
the header, ensure you close connections after the first request.

~Paul

On Mon, Aug 13, 2012 at 10:50:09PM +0000, Kervin L. Pierre wrote:
> Did you get an answer to this question?  I'm running into the same issue.
>
> After piping "POSTs" to get around another issues, we noticed that X-forwarded-For is not being returned to the backend server.
>
> Is there a way to guarantee that x-forwarded-for is present on backend requests, even on pipes?
>
> Best regards,
> Kervin
>
>
> Adevsoft Inc
> Business Software Development
> http://adevsoft.com/
>
> From: varnish-misc-bounces at varnish-cache.org [mailto:varnish-misc-bounces at varnish-cache.org] On Behalf Of Doug Eubanks
> Sent: Friday, August 03, 2012 10:18 AM
> To: varnish-misc at varnish-cache.org
> Subject: Varnish is not always adding X-Forwarded-For
>
> We need Varnish to always add X-Forwarded-For so that we can see the visitor's IP when they submit a poll answer.
>
> We have this setup, but we are still seeing about half of our requests not include the X-Forwarded-For header.
>
> sub vcl_pipe {
> ?? ?? ?? ?? set bereq.http.X-Forwarded-For = req.http.X-Forwarded-For;
> ?? ?? ?? ?? set bereq.http.X-Forwarded-For = regsub(bereq.http.X-Forwarded-For, "$", ", ");
> ?? ?? ?? ?? set bereq.http.X-Forwarded-For = regsub(bereq.http.X-Forwarded-For, "$", client.ip);
> ?? ?? ?? ?? set req.http.connection = "close";
> }
>
> Sincerely,
> Doug Eubanks
> admin at dougware.net
> K1DUG
> (919) 201-8750
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

________________________________

This message may contain confidential or privileged information. If you are not the intended recipient, please advise us immediately and delete this message. See http://www.datapipe.com/legal/email_disclaimer/ for further information on confidentiality and the risks of non-secure electronic communication. If you cannot access these links, please notify us by reply message and we will send the contents to you.



More information about the varnish-misc mailing list