GWicke has uploaded a new change for review.
https://gerrit.wikimedia.org/r/279564
Change subject: WIP: Rewrite /static/ also for PURGE requests
......................................................................
WIP: Rewrite /static/ also for PURGE requests
Bug: T130904
Change-Id: I6ac59be92ad171332c81987e9153be8266ba629e
---
M templates/varnish/text-backend.inc.vcl.erb
M templates/varnish/text-frontend.inc.vcl.erb
2 files changed, 18 insertions(+), 9 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/64/279564/1
diff --git a/templates/varnish/text-backend.inc.vcl.erb
b/templates/varnish/text-backend.inc.vcl.erb
index d07c220..ed987d4 100644
--- a/templates/varnish/text-backend.inc.vcl.erb
+++ b/templates/varnish/text-backend.inc.vcl.erb
@@ -5,6 +5,15 @@
sub cluster_be_recv_pre_purge {
if (req.request == "PURGE") {
call text_normalize_path;
+
+ # normalize all /static to the same hostname for caching
+ if (req.url ~ "^/static/") { set req.http.host = "<%=
@vcl_config.fetch("static_host") %>"; }
+
+ # normalize all /w/static.php to the same wiki host for caching
+ # ignore urls without hash query as those are affected by
multiversion
+ if (req.url ~
"^/w/(skins|resources|extensions)/.+\?[a-fA-F0-9]+$" ) {
+ set req.http.host = "<%=
@vcl_config.fetch("static_host") %>";
+ }
}
}
diff --git a/templates/varnish/text-frontend.inc.vcl.erb
b/templates/varnish/text-frontend.inc.vcl.erb
index 098fa53..c601533 100644
--- a/templates/varnish/text-frontend.inc.vcl.erb
+++ b/templates/varnish/text-frontend.inc.vcl.erb
@@ -113,6 +113,15 @@
// Normalize paths before purging
call text_normalize_path;
+
+ # normalize all /static to the same hostname for caching
+ if (req.url ~ "^/static/") { set req.http.host = "<%=
@vcl_config.fetch("static_host") %>"; }
+
+ # normalize all /w/static.php to the same wiki host for caching
+ # ignore urls without hash query as those are affected by multiversion
+ if (req.url ~ "^/w/(skins|resources|extensions)/.+\?[a-fA-F0-9]+$" ) {
+ set req.http.host = "<%= @vcl_config.fetch("static_host") %>";
+ }
}
sub cluster_fe_recv {
@@ -125,15 +134,6 @@
}
call mobile_redirect;
-
- # normalize all /static to the same hostname for caching
- if (req.url ~ "^/static/") { set req.http.host = "<%=
@vcl_config.fetch("static_host") %>"; }
-
- # normalize all /w/static.php to the same wiki host for caching
- # ignore urls without hash query as those are affected by multiversion
- if (req.url ~ "^/w/(skins|resources|extensions)/.+\?[a-fA-F0-9]+$" ) {
- set req.http.host = "<%= @vcl_config.fetch("static_host") %>";
- }
// Users that just logged out, should not get a 304 for their
// (locally cached) logged in pages.
--
To view, visit https://gerrit.wikimedia.org/r/279564
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6ac59be92ad171332c81987e9153be8266ba629e
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