GWicke has uploaded a new change for review.
https://gerrit.wikimedia.org/r/64008
Change subject: WIP: Parsoid VCL refinements
......................................................................
WIP: Parsoid VCL refinements
This patch adds some support for simple purging and implicit cache refreshes.
Since this is a private service where we have full control over all requests
we don't need to restrict purge access at all.
TODO:
* Figure out how the frontend caches hash to backends
* Maybe use a shared include for both Parsoid front/backends?
Change-Id: I3c512d31189e434bffb751d4cd83c7c86f5d973c
---
M templates/varnish/parsoid-backend.inc.vcl.erb
M templates/varnish/parsoid-frontend.inc.vcl.erb
2 files changed, 18 insertions(+), 11 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/08/64008/1
diff --git a/templates/varnish/parsoid-backend.inc.vcl.erb
b/templates/varnish/parsoid-backend.inc.vcl.erb
index 45676f2..05d96c6 100644
--- a/templates/varnish/parsoid-backend.inc.vcl.erb
+++ b/templates/varnish/parsoid-backend.inc.vcl.erb
@@ -1,4 +1,4 @@
-# Varnish VCL include file for upload backends
+# Varnish VCL include file for Parsoid backends
import std;
@@ -7,15 +7,17 @@
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;
+ }
}
sub vcl_hit {
if (req.request == "PURGE") {
purge;
error 200 "Purged";
- }
- if (req.http.If-Cached && req.http.If-Cached != obj.http.Etag) {
- error 412 "Etag mismatch";
}
}
@@ -24,7 +26,7 @@
purge;
error 200 "Cache miss";
}
- if (req.http.If-Cached) {
+ if (req.http.Cache-Control ~ "only-if-cached") {
error 412 "Entity not in cache";
}
}
diff --git a/templates/varnish/parsoid-frontend.inc.vcl.erb
b/templates/varnish/parsoid-frontend.inc.vcl.erb
index f6c656e..79c07cd 100644
--- a/templates/varnish/parsoid-frontend.inc.vcl.erb
+++ b/templates/varnish/parsoid-frontend.inc.vcl.erb
@@ -7,15 +7,17 @@
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;
+ }
}
sub vcl_hit {
if (req.request == "PURGE") {
purge;
error 200 "Purged";
- }
- if (req.http.If-Cached && req.http.If-Cached != obj.http.Etag) {
- error 412 "Etag mismatch";
}
}
@@ -24,8 +26,11 @@
purge;
error 200 "Cache miss";
}
- /* Make sure If-Cached requests won't pollute the cache */
- if (req.http.If-Cached) {
- return (pass);
+ if (req.request == "PURGE") {
+ purge;
+ error 200 "Cache miss";
+ }
+ if (req.http.Cache-Control ~ "only-if-cached") {
+ error 412 "Entity not in cache";
}
}
--
To view, visit https://gerrit.wikimedia.org/r/64008
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3c512d31189e434bffb751d4cd83c7c86f5d973c
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: GWicke <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits