ArielGlenn has submitted this change and it was merged.
Change subject: Revert "Use pass to avoid caching in frontend, refactoring,
explanatory comments"
......................................................................
Revert "Use pass to avoid caching in frontend, refactoring, explanatory
comments"
This looks like it broke production by returning GET responses to POST requests.
This reverts commit 74ae06f505779643bba374e36f3b6cc8b00a0736
Change-Id: I69b9cfa627ace92f07b8321484d345e33c9e8c9c
---
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, 21 insertions(+), 36 deletions(-)
Approvals:
ArielGlenn: Looks good to me, approved
jenkins-bot: Verified
diff --git a/templates/varnish/parsoid-backend.inc.vcl.erb
b/templates/varnish/parsoid-backend.inc.vcl.erb
index 465b39a..161f91e 100644
--- a/templates/varnish/parsoid-backend.inc.vcl.erb
+++ b/templates/varnish/parsoid-backend.inc.vcl.erb
@@ -3,29 +3,8 @@
# Include common Parsoid config shared between front- and backend
include "parsoid-common.inc.vcl";
-sub vcl_recv {
- call vcl_recv_common;
-
- /* Enable force-refresh.
- * https://www.varnish-cache.org/trac/wiki/VCLExampleEnableForceRefresh
- * During an object refresh, the old object can be requested
- * for re-use with CC: only-if-cached, so purge can't be used for this.
- */
- if (req.http.Cache-Control ~ "no-cache") {
- set req.hash_always_miss = true;
- }
-
- /* Don't run the default vcl_run */
- return (lookup);
-}
-
sub vcl_miss {
if (req.http.Cache-Control ~ "only-if-cached") {
error 412 "Entity not in cache";
}
-}
-
-sub vcl_fetch {
- /* Don't run the default vcl_fetch */
- return (deliver);
}
diff --git a/templates/varnish/parsoid-common.inc.vcl.erb
b/templates/varnish/parsoid-common.inc.vcl.erb
index 2a9a7c4..90b1cc0 100644
--- a/templates/varnish/parsoid-common.inc.vcl.erb
+++ b/templates/varnish/parsoid-common.inc.vcl.erb
@@ -1,8 +1,16 @@
# Varnish VCL include file shared between Parsoid front- and backends
-sub vcl_recv_common {
- /* Clamp the host header to 'parsoid' for both front- and backends.
- * Useful on the backends for testing and direct purging.
- */
- set req.http.host = "parsoid";
-}
+sub vcl_recv {
+ /* 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 bdcde1e..f4812ae 100644
--- a/templates/varnish/parsoid-frontend.inc.vcl.erb
+++ b/templates/varnish/parsoid-frontend.inc.vcl.erb
@@ -3,16 +3,14 @@
# Include common Parsoid config shared between front- and backend
include "parsoid-common.inc.vcl";
-sub vcl_recv {
- call vcl_recv_common;
- /* Don't cache anything
- * Just forward the original request with all headers (including
- * Cache-Control) to the backend.
- */
- return (pass);
+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_fetch {
- /* Don't run the default vcl_fetch */
- return (deliver);
+ set beresp.ttl = 0s;
}
--
To view, visit https://gerrit.wikimedia.org/r/68707
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I69b9cfa627ace92f07b8321484d345e33c9e8c9c
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: GWicke <[email protected]>
Gerrit-Reviewer: ArielGlenn <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Mark Bergsma <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits