I should also mention that I've tested it with varnish 3.0.3, and so should you probably try it on this version first to ensure it actually does what you want. If it doesn't work with varnish 3.0.2 I'll gladly fix that. The client.ip fallback probably belongs more in varnishncsa itself, and I chose the easy path on this one...
Best Regards, Dridi On Wed, Feb 13, 2013 at 10:32 PM, Dridi Boukelmoune <[email protected]> wrote: > Hi, > > Try this vmod instead: https://github.com/dridi/libvmod-logger > > Best Regards, > Dridi > > On Thu, Feb 7, 2013 at 9:03 AM, Andreas Götzfried > <[email protected]> wrote: >> Good Morning, >> >>> I think varnishncsa reads the information in the shared memory log >>> *before* your modification in the VCL. I can't test right now but if >>> you follow both varnishlog and varnishncsa you might understand what >>> happens. >> >> Hm, but then the wished manipulation within vcl_recv (setting >> x-forwarded-for and writing it into varnish log instead of client.ip) >> won't work at all, as the logs are written before vcl_recv. Well, why >> should it work, as varnishncsa reads the shared memory and writes the >> log, and varnish itself reads shared memory and then starts with >> vcl_recv. >> >> https://www.varnish-cache.org/docs/trunk/reference/varnishncsa.html >> >> Changing the parameters of the log daemon won't help either, as an >> external request doesn't set x-forwarded-for- >> >>> I have no idea if it would actually work but you could try to issue a >>> restart to see whether it affects varnishncsa. >>> >>> if (!req.http.X-Forwarded-For) { >>> set req.http.X-Forwarded-For = client.ip; >>> return(restart); >>> } >> >> Message from VCC-compiler: >> Invalid return "restart" >> ('input' Line 97 Pos 24) >> return(restart); >> -----------------------#######-- >> >> ...in subroutine "vcl_recv" >> ('input' Line 77 Pos 5) >> sub vcl_recv { >> ----########-- >> >> ...which is the "vcl_recv" method >> Legal returns are: "error" "lookup" "pass" "pipe" >> >> Seems illegal ;-) >> >> >> thx >> Andreas >> >> _______________________________________________ >> varnish-misc mailing list >> [email protected] >> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc _______________________________________________ varnish-misc mailing list [email protected] https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
