
rowan at jetboy
Aug 10, 2012, 6:01 AM
Post #1 of 1
(154 views)
Permalink
|
|
Conditional logging of X-Fowarded-For in varnishncsa
|
|
With the setup: SSL traffic > nginx > Varnish (for load balancing) > Backend Apache Non-SSL traffic > Varnish > Backend Apache varnishncsa with a custom log format For non-SSL traffic, the IP of the originating request gets logged by varnishncsa as %h; for the SSL traffic it's 127.0.0.1. I can pass the IP from nginx in the X-Forwarded-For header and pick it up in varnishncsa as %{X-Forwarded-For}i. I'd like to log the contents of %{X-Forwarded-For}i if it exists, *OR* %h if it doesn't. Seemingly, the -f command line argument will enable this, but not with a custom format set with the -F flag. This generates the warning "-f and -F can not be combined". Is there a way around this?
|