Not always forwarding client ip

Jason Ledford jledford at biltmore.com
Tue Sep 17 22:35:31 CEST 2013


I have a new setup of varnish and apache and the apache logs are not consistently getting the x-forwarded-for client ip.  It does get them so I feel like its working, but its not all the time.  I have googled around and believe its setup correct.  Varnish has the following defined in the
set req.http.X-Forwarded-For = client.ip;

and apache is setup with a custom log file:
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" varnishcombined

In my logs some entries have my ip and some just have - - - for the ip.  Here is an example with personal info stripped

10.1.250.30 - - [17/Sep/2013:15:31:14 -0500] "GET /_js/jquery.cookie.js HTTP/1.1" 200 837 "mysiteurl" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.66 Safari/537.36"
- - - [17/Sep/2013:15:31:14 -0500] "GET /_images/dropdown/file.jpg HTTP/1.1" 304 - "mysiteurl" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.66 Safari/537.36"
10.1.250.30 - - [17/Sep/2013:15:31:14 -0500] "GET /_images/dropdown/file.jpg HTTP/1.1" 200 27355 "mysiteurl" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.66 Safari/537.36"
- - - [17/Sep/2013:15:31:14 -0500] "GET /_images/dropdown/file.jpg HTTP/1.1" 304 - "mysiteurl" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.66 Safari/537.36"
- - - [17/Sep/2013:15:31:14 -0500] "GET /_images/dropdown/file.jpg HTTP/1.1" 304 - "mysiteurl" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.66 Safari/537.36"
- - - [17/Sep/2013:15:31:14 -0500] "GET /_images/dropdown/file.jpg HTTP/1.1" 304 - "mysiteurl" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.66 Safari/537.36"
10.1.250.30 - - [17/Sep/2013:15:31:14 -0500] "GET /_images/dropdown/file.jpg HTTP/1.1" 200 29160 "http://mysiteurl" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.66 Safari/537.36"


Any help you can offer would be great.  Without this I can't limit using an htaccess since its not reliable where the source is coming from.  Thanks for your help.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20130917/ac396fa6/attachment.html>


More information about the varnish-misc mailing list