Mark Bergsma has submitted this change and it was merged.

Change subject: Split off pass requests from cookie munging
......................................................................


Split off pass requests from cookie munging

Do cookie munging in vcl_hash, as it's only required for caching
reasons.

Change-Id: I8e1f6f88d8da83f767a052c07393d59bd1ddb0d1
---
M templates/varnish/text-backend.inc.vcl.erb
M templates/varnish/text-common.inc.vcl.erb
M templates/varnish/text-frontend.inc.vcl.erb
3 files changed, 16 insertions(+), 11 deletions(-)

Approvals:
  Mark Bergsma: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/templates/varnish/text-backend.inc.vcl.erb 
b/templates/varnish/text-backend.inc.vcl.erb
index 119d40b..a5a74f2 100644
--- a/templates/varnish/text-backend.inc.vcl.erb
+++ b/templates/varnish/text-backend.inc.vcl.erb
@@ -23,15 +23,15 @@
        }
 
 <% end -%>
-       if (req.request != "GET" && req.request != "HEAD") {
-               return (pass);
-       }
-
-       call cookie_munging;
+       call pass_requests;
 
        return(lookup);
 }
 
+sub vcl_hash {
+       call cookie_munging;
+}
+
 sub vcl_pass {
        call restore_cookie;
 }
diff --git a/templates/varnish/text-common.inc.vcl.erb 
b/templates/varnish/text-common.inc.vcl.erb
index a0ca763..527b5f2 100644
--- a/templates/varnish/text-common.inc.vcl.erb
+++ b/templates/varnish/text-common.inc.vcl.erb
@@ -1,10 +1,15 @@
 # Common functions for the Text Varnish cluster
 
-sub cookie_munging {
+sub pass_requests {
+       if (req.request != "GET" && req.request != "HEAD") {
+               return (pass);
+       }
        if (req.http.Cookie ~ "([sS]ession|Token)=") {
                return(pass);
        }
+}
 
+sub cookie_munging {
        /* This header is saved, and restored before sending it to MediaWiki */
        if (req.restarts == 0) {
                set req.http.Orig-Cookie = req.http.Cookie;
diff --git a/templates/varnish/text-frontend.inc.vcl.erb 
b/templates/varnish/text-frontend.inc.vcl.erb
index 4385625..7a788b0 100644
--- a/templates/varnish/text-frontend.inc.vcl.erb
+++ b/templates/varnish/text-frontend.inc.vcl.erb
@@ -41,11 +41,7 @@
 
        call mobile_redirect;
 
-       if (req.request != "GET" && req.request != "HEAD") {
-               return (pass);
-       }
-
-       call cookie_munging;
+       call pass_requests;
 
        /* Users that just logged out, should not get a 304 for their
         * (locally cached) logged in pages. */
@@ -56,6 +52,10 @@
        return(lookup);
 }
 
+sub vcl_hash {
+       call cookie_munging;
+}
+
 sub vcl_pass {
        call restore_cookie;
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8e1f6f88d8da83f767a052c07393d59bd1ddb0d1
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Mark Bergsma <m...@wikimedia.org>
Gerrit-Reviewer: Mark Bergsma <m...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to