<div dir="ltr">You can modify it as you normally would in vcl_recv, by setting req.http.X-Forwarded-For. Note the header may contain two IP addresses depending on your stack, and only one should typically be passed to the backend for proper logging.</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 17, 2017 at 12:32 AM, Oliver Joa <span dir="ltr"><<a href="mailto:ojoa@vwd.com" target="_blank">ojoa@vwd.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<span class=""><br>
<br>
On 14.02.2017 09:41, Guillaume Quintard wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
The snippet is legacy code for v3, and it's now<br>
useless/counter-productive in v4.<br>
</blockquote>
<br></span>
why is the x-forwarded-for-handling now in the source-code? I still use<br>
v3 and have modified it in the vcl-code. If I want to use v4 how can I<br>
modify it?<br>
<br>
Thanks and regards<br>
<br>
Olli<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
<br>
--<br>
Guillaume Quintard<br>
<br>
On Tue, Feb 14, 2017 at 9:20 AM, Donath, Niklas<br></span>
<<a href="mailto:Niklas.Donath@lvdigital.de" target="_blank">Niklas.Donath@lvdigital.de</a> <mailto:<a href="mailto:Niklas.Donath@lvdigital.de" target="_blank">Niklas.Donath@lvdigita<wbr>l.de</a>>> wrote:<br>
<br>
Hi there,____<br>
<br>
__ __<span class=""><br>
<br>
actually, i am in a migration project from varnish 3 to varnish 4.0,<br>
and i was confused about the x-forwarded-for header settings in<br></span>
varnish 4.0:____<span class=""><br>
<br>
in the official doc, it says that x-forwarded-for is automatically<br>
set, like it is obvious in the source code:<br>
<a href="https://github.com/varnishcache/varnish-cache/blob/4.0/bin/varnishd/cache/cache_req_fsm.c#L724" rel="noreferrer" target="_blank">https://github.com/varnishcach<wbr>e/varnish-cache/blob/4.0/bin/<wbr>varnishd/cache/cache_req_fsm.<wbr>c#L724</a><br></span>
<<a href="https://github.com/varnishcache/varnish-cache/blob/4.0/bin/varnishd/cache/cache_req_fsm.c#L724" rel="noreferrer" target="_blank">https://github.com/varnishcac<wbr>he/varnish-cache/blob/4.0/bin/<wbr>varnishd/cache/cache_req_fsm.<wbr>c#L724</a>>____<br>
<br>
__ __<br>
<br>
But a lot of people are adding a snippet for vcl_recv like____<br>
<br>
__ __<br>
<br>
if (req.restarts == 0) {____<br>
<br>
if (req.http.X-Forwarded-For) {____<span class=""><br>
<br>
set req.http.X-Forwarded-For = req.http.X-Forwarded-For + ",<br></span>
" + client.ip;____<br>
<br>
} else {____<br>
<br>
set req.http.X-Forwarded-For = client.ip;____<br>
<br>
}____<br>
<br>
}____<br>
<br>
__ __<span class=""><br>
<br>
Which, from my point of view, is the same implementation as it<br>
already should exist as the docs say. I currently do not have a<br>
LB/proxy infrastructure to test it, so maybe someone can clear this<br>
up, if x-forwarded-for is automatically set by varnish before<br>
executing the vcl_recv from my custom .vcl-file, or if the given<br></span>
snippet is required to set the real user ip for x-forwarded-for.____<br>
<br>
__ __<br>
<br>
Thank you very much!____<br>
<br>
__ __<br>
<br>
Greetings, Niklas____<br>
<br>
__ __<br>
<br>
<br>
______________________________<wbr>_________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a> <mailto:<a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-c<wbr>ache.org</a>><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" rel="noreferrer" target="_blank">https://www.varnish-cache.org/<wbr>lists/mailman/listinfo/varnish<wbr>-misc</a><br>
<<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" rel="noreferrer" target="_blank">https://www.varnish-cache.org<wbr>/lists/mailman/listinfo/varnis<wbr>h-misc</a>><span class=""><br>
<br>
<br>
<br>
<br>
______________________________<wbr>_________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" rel="noreferrer" target="_blank">https://www.varnish-cache.org/<wbr>lists/mailman/listinfo/varnish<wbr>-misc</a><br>
<br>
</span></blockquote>
<br>
<br>
--<br>
Dipl. Inf. (FH) Oliver Joa<br>
Systems, Zeitbeauftragter | Web Technology Systems | vwd group<br>
<br>
vwd Vereinigte Wirtschaftsdienste GmbH<br>
Karl-Götz-Straße 5 | 97424 Schweinfurt<br>
Telefon: <a href="tel:%2B49%209721%20499895-62" value="+49972149989562" target="_blank">+49 9721 499895-62</a> | Telefax: <a href="tel:%2B49%209721%20499895-77" value="+49972149989577" target="_blank">+49 9721 499895-77</a><br>
<a href="mailto:ojoa@vwd.com" target="_blank">ojoa@vwd.com</a> | <a href="http://www.vwd.com" rel="noreferrer" target="_blank">www.vwd.com</a><br>
______________________________<wbr>______________________________<wbr>______<br>
vwd Vereinigte Wirtschaftsdienste GmbH<br>
Sitz der Gesellschaft: Tilsiter Straße 1 | 60487 Frankfurt am Main<br>
Handelsregister: B Frankfurt am Main HRB 100445<br>
Geschäftsführung: Martin Gijssel (CEO), Udo Kersting<br>
<br>
******************************<wbr>******************************<wbr>******************************<wbr>****<br>
<br>
Der Inhalt dieser E-Mail ist ausschließlich für den bezeichneten Adressaten bestimmt.<br>
Wenn Sie nicht der vorgesehene Adressat dieser E-Mail oder dessen Vertreter sein<br>
sollten, so beachten Sie bitte, dass jede Form der Kenntnisnahme, Veröffentlichung,<br>
Vervielfältigung oder Weitergabe des Inhalts dieser E-Mail unzulässig ist. Wir bitten<br>
Sie, sich in diesem Fall mit dem Absender der E-Mail in Verbindung zu setzen.<br>
<br>
The content of this e-mail is meant exclusively for the person to whom it is addressed.<br>
If you are not the person to whom this e-mail is addressed or his/her representative,<br>
please be informed that any form of knowledge, publication, duplication or distribution<br>
of the content of this e-mail is inadmissible. In such cases we kindly ask you to contact<br>
the sender of this e-mail.<br>
<br>
******************************<wbr>******************************<wbr>******************************<wbr>****<div class="HOEnZb"><div class="h5"><br>
<br>
______________________________<wbr>_________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" rel="noreferrer" target="_blank">https://www.varnish-cache.org/<wbr>lists/mailman/listinfo/varnish<wbr>-misc</a><br>
</div></div></blockquote></div><br></div>