Mholloway has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404158 )
Change subject: Stop rewriting m.wikipedia.org and zero.wikipedia.org ...................................................................... Stop rewriting m.wikipedia.org and zero.wikipedia.org Special Apache rules exist for m.wikipedia.org and zero.wikipedia.org to redirect to mobilelanding.php in support of Wikipedia Zero. However, these rules are currently unreachable because requests for these hosts are rewritten in Varnish to bare wikipedia.org due to an unrelated change. See details at https://phabricator.wikimedia.org/T69015#3761037. This patch restores the old behavior, which preserves the m. and zero. subdomains for wikipedia.org when there is no preceding language subdomain (such as en.). Partially reverts 27119b97d628aaa7fa32423d69986bdc693699b5 but preserves and updates the tests added in that commit. Bug: T69015 Change-Id: Ica54a54e78b02375f92b3bc328e0c6aa8544aeb1 --- M modules/varnish/files/tests/text/08-mobile-hostnames-rewrite.vtc M modules/varnish/templates/text-frontend.inc.vcl.erb 2 files changed, 7 insertions(+), 9 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/58/404158/1 diff --git a/modules/varnish/files/tests/text/08-mobile-hostnames-rewrite.vtc b/modules/varnish/files/tests/text/08-mobile-hostnames-rewrite.vtc index c1874cd..204ee0f 100644 --- a/modules/varnish/files/tests/text/08-mobile-hostnames-rewrite.vtc +++ b/modules/varnish/files/tests/text/08-mobile-hostnames-rewrite.vtc @@ -18,7 +18,7 @@ txresp rxreq - expect req.http.x-dt-host == "wikipedia.org" + expect req.http.x-dt-host == "m.wikipedia.org" txresp rxreq diff --git a/modules/varnish/templates/text-frontend.inc.vcl.erb b/modules/varnish/templates/text-frontend.inc.vcl.erb index a63240f..7c15b31 100644 --- a/modules/varnish/templates/text-frontend.inc.vcl.erb +++ b/modules/varnish/templates/text-frontend.inc.vcl.erb @@ -86,24 +86,22 @@ call tag_carrier; } - // Rewrite mobile hostnames to desktop hostnames as x-dt-host. All - // hostnames are being rewritten by the regex in the final else - // clause, except for m.mediawiki.org and m.wikidata.org which are - // rewritten here (because of the www.). + // Rewrite mobile hostnames to desktop hostnames as x-dt-host. if (req.http.host == "m.mediawiki.org") { set req.http.x-dt-host = "www.mediawiki.org"; + } else if (req.http.host == "m.wikimediafoundation.org") { + set req.http.x-dt-host = "wikimediafoundation.org"; + } else if (req.http.host == "m.wikisource.org") { + set req.http.x-dt-host = "wikisource.org"; } else if (req.http.host == "m.wikidata.org") { set req.http.x-dt-host = "www.wikidata.org"; } else { - // All other hostnames are taken care of here. // Replace <language>.(m|zero).<project>.org by <language>.<project>.org - // as well as (m|zero).<project>.org by <project>.org // // Example: - // m.wikimediafoundation.org -> wikimediafoundation.org // it.m.wikipedia.org -> it.wikipedia.org // en.zero.wikipedia.org -> en.wikipedia.org - set req.http.x-dt-host = regsub(req.http.host, "^([a-z0-9-]+\.)?(m|zero)\.", "\1"); + set req.http.x-dt-host = regsub(req.http.host, "^([a-z0-9-]+)\.(m|zero)\.", "\1."); } if (req.url ~ "^/api/rest_v1/") { -- To view, visit https://gerrit.wikimedia.org/r/404158 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ica54a54e78b02375f92b3bc328e0c6aa8544aeb1 Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Mholloway <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
