X-forwarded-for with a load balancer?
Per Buer
perbu at varnish-software.com
Tue Jun 21 15:42:49 CEST 2011
Hi.
2011/6/21 Harri Päiväniemi <harri.paivaniemi at tieto.com>:
>
> We have a varnish behind a load balancer that add's x-forwarded-for- gheader
> to give a client ip.
>
> How to get varnish to just forward that allready set header that it recieves
> from lb to backend instead that varnish is setting it again to lb-ip?
The built in code looks like this:
# if (req.restarts == 0) {
# if (req.http.x-forwarded-for) {
# set req.http.X-Forwarded-For =
# req.http.X-Forwarded-For + ", " + client.ip;
# } else {
# set req.http.X-Forwarded-For = client.ip;
# }
# }
So your original IP should still be there, together with the LB-IP.
You could of course override this code as usual and not mess with the
header, or rename the original.
--
Per Buer, CEO
Phone: +47 21 98 92 61 / Mobile: +47 958 39 117 / Skype: per.buer
Varnish makes websites fly!
Whitepapers | Video | Twitter
More information about the varnish-misc
mailing list