BBlack has submitted this change and it was merged.

Change subject: Fix /static hashing by forcing www.wm.o hostname
......................................................................


Fix /static hashing by forcing www.wm.o hostname

Bug: T104532
Change-Id: I055365fd7f4f413b81e37df63a3f93c88b7833f3
---
M templates/varnish/static-hash.inc.vcl.erb
1 file changed, 8 insertions(+), 3 deletions(-)

Approvals:
  Ori.livneh: Looks good to me, but someone else must approve
  BBlack: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/templates/varnish/static-hash.inc.vcl.erb 
b/templates/varnish/static-hash.inc.vcl.erb
index 62d1208..caf6bfe 100644
--- a/templates/varnish/static-hash.inc.vcl.erb
+++ b/templates/varnish/static-hash.inc.vcl.erb
@@ -1,13 +1,18 @@
 
 // The only difference below from the varnish default vcl_hash implementation
-// is the early return for the static paths.  The point of this is to avoid
+// is the hostname mangling for static paths.  The point of this is to avoid
 // duplicate hashing of the /static/ stuff for every (lang * proj), which
 // would waste a bunch of space (and a bunch of fetches on new static assets)
 sub vcl_hash {
        hash_data(req.url);
 
-       // skip host/ip part for static assets
-       if (req.url ~ "^/static/") { return (hash); }
+       // force host to www.wm.o for /static, so it's always consistent.
+       // Otherwise, requests for apache-level redirect domains cache the
+       // redirect for all possible domains, creating redirect loops.
+       // See: https://phabricator.wikimedia.org/T104532
+       if (req.url ~ "^/static/") {
+               req.http.host = "www.wikimedia.org";
+       }
 
        if (req.http.host) {
                hash_data(req.http.host);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I055365fd7f4f413b81e37df63a3f93c88b7833f3
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: BBlack <bbl...@wikimedia.org>
Gerrit-Reviewer: BBlack <bbl...@wikimedia.org>
Gerrit-Reviewer: Faidon Liambotis <fai...@wikimedia.org>
Gerrit-Reviewer: Krinkle <krinklem...@gmail.com>
Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to