BBlack has submitted this change and it was merged.
Change subject: parsoidecache: fix up various only-if-cached infelicities
......................................................................
parsoidecache: fix up various only-if-cached infelicities
Change-Id: I4ca0847ed9a25bb2ada759e88db32667c2695139
---
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, 25 insertions(+), 0 deletions(-)
Approvals:
BBlack: Verified; Looks good to me, approved
diff --git a/templates/varnish/parsoid-backend.inc.vcl.erb
b/templates/varnish/parsoid-backend.inc.vcl.erb
index 161f91e..e0793ef 100644
--- a/templates/varnish/parsoid-backend.inc.vcl.erb
+++ b/templates/varnish/parsoid-backend.inc.vcl.erb
@@ -8,3 +8,9 @@
error 412 "Entity not in cache";
}
}
+
+sub vcl_pass {
+ 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 17d7550..8142e27 100644
--- a/templates/varnish/parsoid-common.inc.vcl.erb
+++ b/templates/varnish/parsoid-common.inc.vcl.erb
@@ -14,4 +14,15 @@
if (req.http.Cache-Control ~ "no-cache") {
set req.hash_always_miss = true;
}
+
+ # Do not wait on concurrent (possibly actually fetching) requests
+ # for only-if-cached. One would think this could be backend-only,
+ # but it needs to happen in the frontend as well for the same
+ # reason (frontend stalling an only-if-cached miss fetch from
+ # the backend to coalesce with a non-only-if-cached miss fetch
+ # from the backend)
+ if (req.http.Cache-Control ~ "only-if-cached") {
+ set req.hash_ignore_busy = true;
+ return (lookup); // skip default vcl_recv which can generate
pass in some cases...
+ }
}
diff --git a/templates/varnish/parsoid-frontend.inc.vcl.erb
b/templates/varnish/parsoid-frontend.inc.vcl.erb
index f4812ae..c65ff17 100644
--- a/templates/varnish/parsoid-frontend.inc.vcl.erb
+++ b/templates/varnish/parsoid-frontend.inc.vcl.erb
@@ -11,6 +11,14 @@
}
}
+sub vcl_pass {
+ // forward the Cache-Control header to the backend
+ if ( req.http.Cache-Control )
+ {
+ set bereq.http.Cache-Control = req.http.Cache-Control;
+ }
+}
+
sub vcl_fetch {
set beresp.ttl = 0s;
}
--
To view, visit https://gerrit.wikimedia.org/r/165511
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I4ca0847ed9a25bb2ada759e88db32667c2695139
Gerrit-PatchSet: 5
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: BBlack <[email protected]>
Gerrit-Reviewer: BBlack <[email protected]>
Gerrit-Reviewer: GWicke <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits