Mark Bergsma has uploaded a new change for review.

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


Change subject: Alternative way to refresh content with purging
......................................................................

Alternative way to refresh content with purging

Change-Id: I51bb4fcbcfe7723e52a472259eb05396b9bdd9e5
---
M templates/varnish/parsoid-backend.inc.vcl.erb
M templates/varnish/parsoid-common.inc.vcl.erb
M templates/varnish/parsoid-frontend.inc.vcl.erb
3 files changed, 17 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/13/68413/1

diff --git a/templates/varnish/parsoid-backend.inc.vcl.erb 
b/templates/varnish/parsoid-backend.inc.vcl.erb
index 161f91e..470fcd4 100644
--- a/templates/varnish/parsoid-backend.inc.vcl.erb
+++ b/templates/varnish/parsoid-backend.inc.vcl.erb
@@ -3,6 +3,19 @@
 # Include common Parsoid config shared between front- and backend
 include "parsoid-common.inc.vcl";
 
+sub vcl_recv {
+       call vcl_recv_common;
+
+       return (lookup);
+}
+
+sub vcl_hit {
+       if (req.http.Cache-Control ~ "no-cache") {
+               purge;
+               restart;
+       }
+}
+
 sub vcl_miss {
        if (req.http.Cache-Control ~ "only-if-cached") {
                error 412 "Entity not in cache";
diff --git a/templates/varnish/parsoid-common.inc.vcl.erb 
b/templates/varnish/parsoid-common.inc.vcl.erb
index 90b1cc0..4137649 100644
--- a/templates/varnish/parsoid-common.inc.vcl.erb
+++ b/templates/varnish/parsoid-common.inc.vcl.erb
@@ -1,16 +1,11 @@
 # Varnish VCL include file shared between Parsoid front- and backends
 
-sub vcl_recv {
+sub vcl_recv_common {
        /* Clamp the host header to 'parsoid' */
        set req.http.host = "parsoid";
 
        /* Support HTTP PURGE */
        if (req.request == "PURGE") {
                return (lookup);
-       }
-       // Enable force-refresh
-       // See 
https://www.varnish-cache.org/trac/wiki/VCLExampleEnableForceRefresh
-       if (req.http.Cache-Control ~ "no-cache") {
-               set req.hash_always_miss = true;
        }
 }
diff --git a/templates/varnish/parsoid-frontend.inc.vcl.erb 
b/templates/varnish/parsoid-frontend.inc.vcl.erb
index f4812ae..ef5461f 100644
--- a/templates/varnish/parsoid-frontend.inc.vcl.erb
+++ b/templates/varnish/parsoid-frontend.inc.vcl.erb
@@ -3,14 +3,8 @@
 # Include common Parsoid config shared between front- and backend
 include "parsoid-common.inc.vcl";
 
-sub vcl_miss {
-       // forward the Cache-Control header to the backend
-       if ( req.http.Cache-Control )
-       {
-               set bereq.http.Cache-Control = req.http.Cache-Control;
-       }
-}
+sub vcl_recv {
+       call vcl_recv_common;
 
-sub vcl_fetch {
-       set beresp.ttl = 0s;
+       return (pass);
 }

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

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

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

Reply via email to