X-Forwarded-For automatically set in varnish 4.0?
dridi at varni.sh
Mon Feb 20 11:02:07 CET 2017
Joining the discussion a bit late, but still...
On Tue, Feb 14, 2017 at 9:20 AM, Donath, Niklas
<Niklas.Donath at lvdigital.de> wrote:
> Hi there,
> actually, i am in a migration project from varnish 3 to varnish 4.0, and i
> was confused about the x-forwarded-for header settings in varnish 4.0:
I strongly recommend moving directly to 4.1, it's the same amount of
effort if you come from 3.0 anyway, with better support.
> in the official doc, it says that x-forwarded-for is automatically set, like
> it is obvious in the source code:
> But a lot of people are adding a snippet for vcl_recv like
Yes, people sometimes miss changes, especially during a migration or
when docs for older versions are better referenced.
> Which, from my point of view, is the same implementation as it already
> should exist as the docs say. I currently do not have a LB/proxy
> infrastructure to test it, so maybe someone can clear this up, if
> x-forwarded-for is automatically set by varnish before executing the
> vcl_recv from my custom .vcl-file, or if the given snippet is required to
> set the real user ip for x-forwarded-for.
You nailed the core code that does it, why even doubt? If you really
need to clear your doubts run varnishlog, capture a transaction, and
you will see that xff is set before entering vcl_recv for 4.0+.
More information about the varnish-misc