Krinkle has uploaded a new change for review. https://gerrit.wikimedia.org/r/269149
Change subject: cache: Normalise hostname for /w/skins,resources,extensions ...................................................................... cache: Normalise hostname for /w/skins,resources,extensions These are the same for all wiki hosts since they're served from a universal document root. In anticipation of T99096, ignore requests without a hashed query string as those may be subject to multiversion resolution based on wiki hostname. Those with a hash, are processed in a wiki-agonistic way. Bug: T99096 Change-Id: I0c1b6116aed8474783915c0ad7818a4ce7c3eaff --- M hieradata/labs.yaml M modules/role/manifests/cache/base.pp M modules/role/manifests/cache/mobile.pp M modules/role/manifests/cache/text.pp M templates/varnish/text-frontend.inc.vcl.erb 5 files changed, 11 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/49/269149/1 diff --git a/hieradata/labs.yaml b/hieradata/labs.yaml index f02b0f8..f2d256c 100644 --- a/hieradata/labs.yaml +++ b/hieradata/labs.yaml @@ -40,6 +40,7 @@ role::cache::base::purge_host_only_upload_re: '^upload\.beta\.wmflabs\.org$' role::cache::base::purge_host_not_upload_re: '^(?!upload\.beta\.wmflabs\.org)' role::cache::base::static_host: 'deployment.wikimedia.beta.wmflabs.org' +role::cache::base::static_wikihost: 'deployment.wikimedia.beta.wmflabs.org' role::cache::base::upload_domain: 'upload.beta.wmflabs.org' role::cache::base::bits_domain: 'bits.beta.wmflabs.org' role::cache::base::top_domain: 'beta.wmflabs.org' diff --git a/modules/role/manifests/cache/base.pp b/modules/role/manifests/cache/base.pp index ec76ef11..9e9eb4a 100644 --- a/modules/role/manifests/cache/base.pp +++ b/modules/role/manifests/cache/base.pp @@ -3,6 +3,7 @@ $purge_host_only_upload_re = '^upload\.wikimedia\.org$', $purge_host_not_upload_re = '^(?!upload\.wikimedia\.org)', $static_host = 'www.wikimedia.org', + $static_wikihost = 'commons.wikimedia.org', $upload_domain = 'upload.wikimedia.org', $bits_domain = 'bits.wikimedia.org', $top_domain = 'org' diff --git a/modules/role/manifests/cache/mobile.pp b/modules/role/manifests/cache/mobile.pp index 31b2c4e..022d73b 100644 --- a/modules/role/manifests/cache/mobile.pp +++ b/modules/role/manifests/cache/mobile.pp @@ -116,6 +116,7 @@ 'cache4xx' => '1m', 'purge_host_regex' => $::role::cache::base::purge_host_not_upload_re, 'static_host' => $::role::cache::base::static_host, + 'static_wikihost' => $::role::cache::base::static_wikihost, 'bits_domain' => $::role::cache::base::bits_domain, 'top_domain' => $::role::cache::base::top_domain, 'do_gzip' => true, diff --git a/modules/role/manifests/cache/text.pp b/modules/role/manifests/cache/text.pp index 9e9cc17..1796229 100644 --- a/modules/role/manifests/cache/text.pp +++ b/modules/role/manifests/cache/text.pp @@ -119,6 +119,7 @@ 'cache4xx' => '1m', 'purge_host_regex' => $::role::cache::base::purge_host_not_upload_re, 'static_host' => $::role::cache::base::static_host, + 'static_wikihost' => $::role::cache::base::static_wikihost, 'bits_domain' => $::role::cache::base::bits_domain, 'top_domain' => $::role::cache::base::top_domain, 'do_gzip' => true, diff --git a/templates/varnish/text-frontend.inc.vcl.erb b/templates/varnish/text-frontend.inc.vcl.erb index 71a8d71..59d3fc5 100644 --- a/templates/varnish/text-frontend.inc.vcl.erb +++ b/templates/varnish/text-frontend.inc.vcl.erb @@ -231,9 +231,15 @@ call mobile_redirect; - # normalize all /static to the same hostname for caching + # normalize all /static to the same generic 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 subject to multiversion + if (req.url ~ "^/w/(skins|resources|extensions)/.+\?[a-fA-F0-9]+$" ) { + set req.http.host = "<%= @vcl_config.fetch("static_wikihost") %>"; + } + // Users that just logged out, should not get a 304 for their // (locally cached) logged in pages. if (req.http.If-Modified-Since && req.http.Cookie ~ "LoggedOut") { -- To view, visit https://gerrit.wikimedia.org/r/269149 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0c1b6116aed8474783915c0ad7818a4ce7c3eaff Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Krinkle <krinklem...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits