BBlack has submitted this change and it was merged.

Change subject: Revert "purging: do not VCL-filter on domain regex"
......................................................................


Revert "purging: do not VCL-filter on domain regex"

This reverts commit 264a3848483f68e1d657ca46a33d0e3ba5105d45.

(Note this isn't a clean revert, as conflicting changes to misc.pp
have happened since, but it's a correct logical revert)

Bug: T119038
Change-Id: I8f4bc4dca2537a2e6c2acbc93cbc2b3d5b86ac8b
---
M hieradata/labs.yaml
M modules/role/manifests/cache/base.pp
M modules/role/manifests/cache/maps.pp
M modules/role/manifests/cache/misc.pp
M modules/role/manifests/cache/mobile.pp
M modules/role/manifests/cache/parsoid.pp
M modules/role/manifests/cache/text.pp
M modules/role/manifests/cache/upload.pp
M modules/varnish/templates/vcl/wikimedia.vcl.erb
9 files changed, 15 insertions(+), 2 deletions(-)

Approvals:
  BBlack: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/hieradata/labs.yaml b/hieradata/labs.yaml
index 3232470..f88ccfe 100644
--- a/hieradata/labs.yaml
+++ b/hieradata/labs.yaml
@@ -37,6 +37,8 @@
     eqiad:
       - '127.0.0.1'
 role::cache::base::zero_site: 'http://zero.wikimedia.beta.wmflabs.org'
+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::upload_domain: 'upload.beta.wmflabs.org'
 role::cache::base::bits_domain: 'bits.beta.wmflabs.org'
diff --git a/modules/role/manifests/cache/base.pp 
b/modules/role/manifests/cache/base.pp
index 10284c4..824ff7d 100644
--- a/modules/role/manifests/cache/base.pp
+++ b/modules/role/manifests/cache/base.pp
@@ -1,5 +1,7 @@
 class role::cache::base(
     $zero_site = 'https://zero.wikimedia.org',
+    $purge_host_only_upload_re = '^upload\.wikimedia\.org$',
+    $purge_host_not_upload_re = '^(?!upload\.wikimedia\.org)',
     $static_host = 'www.wikimedia.org',
     $upload_domain = 'upload.wikimedia.org',
     $bits_domain = 'bits.wikimedia.org',
diff --git a/modules/role/manifests/cache/maps.pp 
b/modules/role/manifests/cache/maps.pp
index 41bae01..2ac5b6d 100644
--- a/modules/role/manifests/cache/maps.pp
+++ b/modules/role/manifests/cache/maps.pp
@@ -38,6 +38,7 @@
 
     $common_vcl_config = {
         'cache4xx'         => '1m',
+        'purge_host_regex' => $::role::cache::base::purge_host_not_upload_re,
         'do_gzip'          => true,
     }
 
diff --git a/modules/role/manifests/cache/misc.pp 
b/modules/role/manifests/cache/misc.pp
index c496ab7..eac4479 100644
--- a/modules/role/manifests/cache/misc.pp
+++ b/modules/role/manifests/cache/misc.pp
@@ -213,6 +213,7 @@
         'cache4xx'         => '1m',
         'do_gzip'          => true,
         'allowed_methods'  => '^(GET|DELETE|HEAD|POST|PURGE|PUT)$',
+        'purge_host_regex' => $::role::cache::base::purge_host_not_upload_re,
     }
 
     $fe_vcl_config = merge($common_vcl_config, {
diff --git a/modules/role/manifests/cache/mobile.pp 
b/modules/role/manifests/cache/mobile.pp
index 060796f..25f6d62 100644
--- a/modules/role/manifests/cache/mobile.pp
+++ b/modules/role/manifests/cache/mobile.pp
@@ -78,6 +78,7 @@
 
     $common_vcl_config = {
         'cache4xx'           => '1m',
+        'purge_host_regex'   => $::role::cache::base::purge_host_not_upload_re,
         'static_host'        => $::role::cache::base::static_host,
         'bits_domain'        => $::role::cache::base::bits_domain,
         'top_domain'         => $::role::cache::base::top_domain,
diff --git a/modules/role/manifests/cache/parsoid.pp 
b/modules/role/manifests/cache/parsoid.pp
index 068a891..e6df59e 100644
--- a/modules/role/manifests/cache/parsoid.pp
+++ b/modules/role/manifests/cache/parsoid.pp
@@ -20,6 +20,7 @@
     include role::cache::ssl::unified
 
     $common_vcl_config = {
+        'purge_host_regex' => $::role::cache::base::purge_host_not_upload_re,
     }
 
     $be_vcl_config = merge($common_vcl_config, {
diff --git a/modules/role/manifests/cache/text.pp 
b/modules/role/manifests/cache/text.pp
index 3dd8c6d..e9cbaa5 100644
--- a/modules/role/manifests/cache/text.pp
+++ b/modules/role/manifests/cache/text.pp
@@ -78,6 +78,7 @@
 
     $common_vcl_config = {
         'cache4xx'           => '1m',
+        'purge_host_regex'   => $::role::cache::base::purge_host_not_upload_re,
         'static_host'        => $::role::cache::base::static_host,
         'bits_domain'        => $::role::cache::base::bits_domain,
         'top_domain'         => $::role::cache::base::top_domain,
diff --git a/modules/role/manifests/cache/upload.pp 
b/modules/role/manifests/cache/upload.pp
index 87d0cd2..ee193c4 100644
--- a/modules/role/manifests/cache/upload.pp
+++ b/modules/role/manifests/cache/upload.pp
@@ -49,6 +49,7 @@
 
     $common_vcl_config = {
         'cache4xx'         => '1m',
+        'purge_host_regex' => $::role::cache::base::purge_host_only_upload_re,
         'upload_domain'    => $::role::cache::base::upload_domain,
         'do_gzip'          => true,
     }
diff --git a/modules/varnish/templates/vcl/wikimedia.vcl.erb 
b/modules/varnish/templates/vcl/wikimedia.vcl.erb
index 452c768..19078d2 100644
--- a/modules/varnish/templates/vcl/wikimedia.vcl.erb
+++ b/modules/varnish/templates/vcl/wikimedia.vcl.erb
@@ -369,9 +369,12 @@
        if (req.request == "PURGE") {
                if (!client.ip ~ purge) {
                        error 405 "Denied.";
+               } elsif (req.http.Host ~ "<%= 
@vcl_config.fetch('purge_host_regex') %>") {
+                       set req.hash_ignore_busy = true;
+                       return (lookup);
+               } else {
+                       error 204 "Domain not cached here.";
                }
-               set req.hash_ignore_busy = true;
-               return (lookup);
        }
 }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8f4bc4dca2537a2e6c2acbc93cbc2b3d5b86ac8b
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: BBlack <bbl...@wikimedia.org>
Gerrit-Reviewer: BBlack <bbl...@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