<div dir="ltr">Hi,<div><br></div><div>If I read this correctly: <a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/application/x-forwarded-headers.html">https://docs.aws.amazon.com/elasticloadbalancing/latest/application/x-forwarded-headers.html</a> , you can trust the before-last IP, because it was added by the ALB, always. (and using vmod_str makes it easy to retrieve <a href="https://github.com/varnish/varnish-modules/blob/master/src/vmod_str.vcc#L42">https://github.com/varnish/varnish-modules/blob/master/src/vmod_str.vcc#L42</a>)<br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><br></div><div>Side question: would an NLB work? They support proxy-protocol, that would also solve your problem.</div><div><br></div><div>Cheers,</div><div><br></div><div>-- <br></div><div>Guillaume Quintard<br></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Aug 19, 2021 at 1:52 PM Carlos Abalde <<a href="mailto:carlos.abalde@gmail.com">carlos.abalde@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;">Hi,<div><br></div><div><div>No so sure about that. Let's assume the client address is 1.1.1.1. Two possible scenarios:</div><div><br></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div>- The client request reaches the ALB without XFF. The ALB will inject XFF with value 1.1.1.1. Then Varnish will modify XFF adding the ALB's address (i.e., 1.1.1.1,<ALB IP>). Using the next-to-last IP you're using the right client address.</div></div><div><div><br></div></div><div><div>- The client request reaches the ALB with a forged XFF (e.g. 127.0.0.1). The ALB will will modify XFF (i.e. 127.0.0.1,1.1.1.1). The Varnish will do the same (i.e. 127.0.0.1,1.1.1.1,<ALB IP>). Using the next-to-last IP you're still using the right client address.</div></div></blockquote><div><div><br></div><div>I've not checked using a ALB, but that should be the expected behaviour for me.</div><div><br></div><div>Best,</div><div><br></div><div>--</div><div>Carlos Abalde</div><div><br></div></div></div>_______________________________________________<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/lists/mailman/listinfo/varnish-misc</a><br>
</blockquote></div>