r5113 - trunk/varnish-cache/bin/varnishd

phk at varnish-cache.org phk at varnish-cache.org
Sat Aug 21 14:03:19 CEST 2010


Author: phk
Date: 2010-08-21 14:03:19 +0200 (Sat, 21 Aug 2010)
New Revision: 5113

Modified:
   trunk/varnish-cache/bin/varnishd/default.vcl
Log:
Don't mess with X-forwarded-for on restarts.

Fixes: #758



Modified: trunk/varnish-cache/bin/varnishd/default.vcl
===================================================================
--- trunk/varnish-cache/bin/varnishd/default.vcl	2010-08-21 12:02:17 UTC (rev 5112)
+++ trunk/varnish-cache/bin/varnishd/default.vcl	2010-08-21 12:03:19 UTC (rev 5113)
@@ -40,11 +40,13 @@
  */
 
 sub vcl_recv {
-    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;
+    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;
+	}
     }
     if (req.request != "GET" &&
       req.request != "HEAD" &&




More information about the varnish-commit mailing list