<div dir="auto">Hello, <div dir="auto"><br></div><div dir="auto">Why is this part if code useless ? </div><div dir="auto">Is that because this code is in the builtin.vcl ?</div><div dir="auto"><br></div><div dir="auto">Thanks</div></div><div class="gmail_extra"><br><div class="gmail_quote">Le 14 févr. 2017 10:10 AM, "Guillaume Quintard" <<a href="mailto:guillaume@varnish-software.com">guillaume@varnish-software.com</a>> a écrit :<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>The snippet is legacy code for v3, and it's now useless/counter-productive in v4.</div></div><div class="gmail_extra"><br clear="all"><div><div class="m_1230026204366212524gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>-- <br></div>Guillaume Quintard<br></div></div></div>
<br><div class="gmail_quote">On Tue, Feb 14, 2017 at 9:20 AM, Donath, Niklas <span dir="ltr"><<a href="mailto:Niklas.Donath@lvdigital.de" target="_blank">Niklas.Donath@lvdigital.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">







<div bgcolor="white" lang="DE" link="#0563C1" vlink="#954F72">
<div class="m_1230026204366212524m_-748305146233834759WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Hi there,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">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:<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">in the official doc, it says that x-forwarded-for is automatically set, like it is obvious in the source code:
<a href="https://github.com/varnishcache/varnish-cache/blob/4.0/bin/varnishd/cache/cache_req_fsm.c#L724" target="_blank">
https://github.com/varnishcach<wbr>e/varnish-cache/blob/4.0/bin/<wbr>varnishd/cache/cache_req_fsm.<wbr>c#L724</a><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">But a lot of people are adding a snippet for vcl_recv like<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">if (req.restarts == 0) {<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">    if (req.http.X-Forwarded-For) {<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">        set req.http.X-Forwarded-For = req.http.X-Forwarded-For + ", " + client.ip;<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">    } else {<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">        set req.http.X-Forwarded-For = client.ip;<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">    </span><span style="font-size:11.0pt">}<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">}<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">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.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Thank you very much!<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Greetings, Niklas<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><u></u> <u></u></span></p>
</div>
</div>

<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></blockquote></div><br></div>
<br>______________________________<wbr>_________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org">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/<wbr>varnish-misc</a><br></blockquote></div></div>