BBlack has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/301367

Change subject: cache_misc: avoid caching authcookie reqs as well
......................................................................

cache_misc: avoid caching authcookie reqs as well

Change-Id: Ib228784e4482993ad5a42c7a8e2635263b851b82
---
M templates/varnish/misc-common.inc.vcl.erb
1 file changed, 11 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/67/301367/1

diff --git a/templates/varnish/misc-common.inc.vcl.erb 
b/templates/varnish/misc-common.inc.vcl.erb
index 6a74cba..fd4a219 100644
--- a/templates/varnish/misc-common.inc.vcl.erb
+++ b/templates/varnish/misc-common.inc.vcl.erb
@@ -18,10 +18,18 @@
         return (pass);
     }
 
-    // Note default builtin VCL would pass on req.http.Cookie here too, but
-    // that would pass virtually all content, as junk cookies are common
-    // (including our own, for these purposes)
+    // don't cache authorized requests
     if (req.http.Authorization) {
         return (pass);
     }
+
+    // don't cache cookie requests, but ignore google analytics cookies and our
+    // own global WMF-Last-Access and CP cookies.
+    set req.http.NC-Cookie = regsuball(req.http.Cookie, 
"(?i)(^|;\s*)(_ga[-_a-z]*|_utm[-_a-z]*|WMF-Last-Access|CP)=[^;]*", "");
+    set req.http.NC-Cookie = regsub(req.http.NC-Cookie, "^;?\s*", "");
+    if (req.http.NC-Cookie != "") {
+        unset req.http.NC-Cookie;
+        return (pass);
+    }
+    unset req.http.NC-Cookie;
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/301367
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib228784e4482993ad5a42c7a8e2635263b851b82
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: BBlack <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to