Logging the client IP with Nginx/Varnish/Apache

me at ibotty.net me at ibotty.net
Mon Oct 22 18:39:57 CEST 2012


hi,

> Is there a nice simple way to stop Varnish rewriting X-Forwarded-For
> if it's already populated?

you should not unconditionally trust any http header. so the best way
might be to check for presence of the header and rewrite it unless the
client's ip is 127.0.0.1. two if clauses should do just fine. (if it
does not work for you, i can get a snippet i once wrote. but that won't
be tomorrow.)

tobi



More information about the varnish-misc mailing list