add req.http.x-forwarded-for header

Dridi Boukelmoune dridi.boukelmoune at zenika.com
Wed Feb 6 18:40:55 CET 2013


Hi,

I think varnishncsa reads the information in the shared memory log
*before* your modification in the VCL. I can't test right now but if
you follow both varnishlog and varnishncsa you might understand what
happens.

I have no idea if it would actually work but you could try to issue a
restart to see whether it affects varnishncsa.

if (!req.http.X-Forwarded-For) {
    set req.http.X-Forwarded-For = client.ip;
    return(restart);
}

Best Regards,
Dridi

On Wed, Feb 6, 2013 at 5:25 PM, Andreas Götzfried
<revirii at googlemail.com> wrote:
> Hi all,
>
> sorry for the last thread, i'm not really used to working with mailing
> lists. I hope at least this message get's sorted properly...
>
> Hi Raul,
>
> thanks for your answer! I checked vcl_recv but couldn't find anything
> relevant. And i don't think this is the problem, because:
>
> I.
> nginx.https -> varnish
> x-forwarded-for is logged in /var/log/varnish/varnish.log
>
> II.
> only varnish.http
> x-forwarded-for isn't logged in /var/log/varnish/varnish.log
>
> So this has to be a quite strange return statement that clears the
> x-forwarded-for when the http request is received by varnish
> externally, but leaves the header untouched when it's sent via nginx
> (and this traffic is http as well).
>
> I'll re-check the code again, but... :-/
>
>
> Andreas
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc



More information about the varnish-misc mailing list