BBlack has submitted this change and it was merged.

Change subject: Fix /static 404s in beta
......................................................................


Fix /static 404s in beta

Since there is no www.wikimedia.org host in beta cluster, when the
text-frontend cache sends a request to that host using the text-backend
ip and port the result is a 404; however if you use a valid beta host
the static directory works as expected.

Bug: T105541
Change-Id: I7ad956fbe1f9f7c7fe524a2fa12efd164952f4ab
---
M hieradata/labs.yaml
M modules/role/manifests/cache/configuration.pp
M templates/varnish/text-frontend.inc.vcl.erb
3 files changed, 3 insertions(+), 1 deletion(-)

Approvals:
  20after4: Looks good to me, but someone else must approve
  BBlack: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/hieradata/labs.yaml b/hieradata/labs.yaml
index 46d34a1..9b2105d 100644
--- a/hieradata/labs.yaml
+++ b/hieradata/labs.yaml
@@ -44,6 +44,7 @@
 role::cache::bits::bits_domain: 'bits.beta.wmflabs.org'
 role::cache::bits::top_domain: 'beta.wmflabs.org'
 role::cache::mobile::zero_site: 'http://zero.wikimedia.beta.wmflabs.org'
+role::cache::text::static_host: 'deployment.wikimedia.beta.wmflabs.org'
 zookeeper_hosts:
   "${::fqdn}": 1
 nrpe::allowed_hosts: '10.68.16.195'
diff --git a/modules/role/manifests/cache/configuration.pp 
b/modules/role/manifests/cache/configuration.pp
index 639a5c7..536f71c 100644
--- a/modules/role/manifests/cache/configuration.pp
+++ b/modules/role/manifests/cache/configuration.pp
@@ -2,6 +2,7 @@
     include lvs::configuration
 
     $has_ganglia = hiera('has_ganglia', true)
+    $static_host = hiera('role::cache::text::static_host', 'www.wikimedia.org')
 
     $backends = {
         'production' => {
diff --git a/templates/varnish/text-frontend.inc.vcl.erb 
b/templates/varnish/text-frontend.inc.vcl.erb
index be3e047..a1e3dcf 100644
--- a/templates/varnish/text-frontend.inc.vcl.erb
+++ b/templates/varnish/text-frontend.inc.vcl.erb
@@ -87,7 +87,7 @@
        call mobile_redirect;
 
        # normalize all /static to the same hostname for caching
-       if (req.url ~ "^/static/") { set req.http.host = "www.wikimedia.org"; }
+       if (req.url ~ "^/static/") { set req.http.host = "<%= 
scope['role::cache::configuration::static_host'] %>"; }
 
        if (req.http.host ~ "^test\.") {
                set req.http.X-Wikimedia-Debug = "1";

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I7ad956fbe1f9f7c7fe524a2fa12efd164952f4ab
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Thcipriani <tcipri...@wikimedia.org>
Gerrit-Reviewer: 20after4 <mmod...@wikimedia.org>
Gerrit-Reviewer: BBlack <bbl...@wikimedia.org>
Gerrit-Reviewer: Hashar <has...@free.fr>
Gerrit-Reviewer: Krinkle <krinklem...@gmail.com>
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