Mark Bergsma has uploaded a new change for review.

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


Change subject: Move proxy URL rewriting into a function
......................................................................

Move proxy URL rewriting into a function

...so it can be used more generically

Change-Id: I48288d264111f502887d00d775bd40f7e7a9e189
---
M templates/varnish/wikimedia.vcl.erb
1 file changed, 8 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/99/60399/1

diff --git a/templates/varnish/wikimedia.vcl.erb 
b/templates/varnish/wikimedia.vcl.erb
index 96b2e7d..f581e50 100644
--- a/templates/varnish/wikimedia.vcl.erb
+++ b/templates/varnish/wikimedia.vcl.erb
@@ -172,6 +172,12 @@
 
 # Functions
 
+sub rewrite_proxy_urls {
+       if (req.url ~ "^http:") {
+               set req.url = regsub ( req.url, "^http://[\w.]+(/.*)", "\1");
+       }
+}
+
 sub vcl_recv_purge {
        /* Support HTTP PURGE from localhost */
        if (req.request == "PURGE") {
@@ -179,8 +185,8 @@
                        error 405 "Denied.";
                # This is a stupid hack to make varnishhtcpd work - it's using 
a perl mod that sends purge reqs like
                # PURGE 
http://de.wikipedia.orghttp://de.wikipedia.org/w/index.php
-               } elsif (req.url ~ "^http:") {
-                       set req.url = regsub ( req.url, "^http://[\w.]+(/.*)", 
"\1");
+               } else {
+                       call rewrite_proxy_urls;
                }
                return (lookup);
        }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I48288d264111f502887d00d775bd40f7e7a9e189
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Mark Bergsma <m...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to