Mark Bergsma has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/60417


Change subject: Restrict PURGE lookups to mobile domains
......................................................................

Restrict PURGE lookups to mobile domains

Change-Id: I77b88f3b4bb5ec84f70b2241cdd5dc496025e6fd
---
M templates/varnish/mobile-backend.inc.vcl.erb
M templates/varnish/mobile-frontend.inc.vcl.erb
2 files changed, 13 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/17/60417/1

diff --git a/templates/varnish/mobile-backend.inc.vcl.erb 
b/templates/varnish/mobile-backend.inc.vcl.erb
index ba61fbc..cfc5746 100644
--- a/templates/varnish/mobile-backend.inc.vcl.erb
+++ b/templates/varnish/mobile-backend.inc.vcl.erb
@@ -1,7 +1,12 @@
 # Varnish VCL include file for mobile backends
 
 sub vcl_recv {
-       call vcl_recv_purge;
+       if (req.host ~ "^([a-zA-Z0-9-]+)\.(m|zero|wap|mobile)\.") {
+               call vcl_recv_purge;
+       }
+       elsif (req.request == "PURGE") {
+               error 200 "Domain not cached here.";
+       }
 
        if ( req.http.host ~ "^test\." ) {
                set req.backend = test_wikipedia;
diff --git a/templates/varnish/mobile-frontend.inc.vcl.erb 
b/templates/varnish/mobile-frontend.inc.vcl.erb
index 7424136..80b68d7 100644
--- a/templates/varnish/mobile-frontend.inc.vcl.erb
+++ b/templates/varnish/mobile-frontend.inc.vcl.erb
@@ -513,8 +513,13 @@
 }
 
 sub vcl_recv {
-       call rewrite_proxy_urls;
-       call vcl_recv_purge;
+       if (req.host ~ "^([a-zA-Z0-9-]+)\.(m|zero|wap|mobile)\.") {
+               call vcl_recv_purge;
+       }
+       elsif (req.request == "PURGE") {
+               error 200 "Domain not cached here.";
+       }
+
        /* if the request comes from Opera Mini's accelerating proxies, grab
         * XFF Header and replace client ip value */
        if (client.ip ~ opera_mini) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I77b88f3b4bb5ec84f70b2241cdd5dc496025e6fd
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Mark Bergsma <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to