BryanDavis has uploaded a new change for review.
https://gerrit.wikimedia.org/r/109330
Change subject: Allow PUT method to hosts behind the misc Varnish cluster
......................................................................
Allow PUT method to hosts behind the misc Varnish cluster
RESTful applications often use a wider variety of HTTP methods than the
MediaWiki stack has traditionally required. This change provides
a mechanism for individual Varnish clusters to describe the set of
methods that they will allow via a regular expression. The default
behavior is to preserve the historical list of GET, HEAD, POST and
PURGE.
The PUT method is being added to misc at this time specifically to
support the dashboard save feature of the Kibana frontend used for
logstash.wikimedia.org.
Bug: 60350
Change-Id: Iea96bbedd8f351e3452f0dc2aaf3a9d42d78b165
---
M manifests/role/cache.pp
M modules/varnish/manifests/instance.pp
M modules/varnish/templates/vcl/wikimedia.vcl.erb
3 files changed, 4 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/30/109330/1
diff --git a/manifests/role/cache.pp b/manifests/role/cache.pp
index 3a1bb44..6004699 100644
--- a/manifests/role/cache.pp
+++ b/manifests/role/cache.pp
@@ -1214,6 +1214,7 @@
'logstash1003.eqiad.wmnet',
]
},
+ allowed_methods => '^(GET|HEAD|POST|PURGE|PUT)$',
}
}
}
diff --git a/modules/varnish/manifests/instance.pp
b/modules/varnish/manifests/instance.pp
index ef50ec1..feab382 100644
--- a/modules/varnish/manifests/instance.pp
+++ b/modules/varnish/manifests/instance.pp
@@ -14,7 +14,8 @@
$backend_options,
$cluster_options={},
$wikimedia_networks=[],
- $xff_sources=[]
+ $xff_sources=[],
+ $allowed_methods='^(GET|HEAD|POST|PURGE)$',
) {
include varnish::common
diff --git a/modules/varnish/templates/vcl/wikimedia.vcl.erb
b/modules/varnish/templates/vcl/wikimedia.vcl.erb
index 7787f1a..d9552aa 100644
--- a/modules/varnish/templates/vcl/wikimedia.vcl.erb
+++ b/modules/varnish/templates/vcl/wikimedia.vcl.erb
@@ -272,7 +272,7 @@
<% end -%>
sub vcl_recv {
- if (req.request !~ "^(GET|HEAD|POST|PURGE)$"
+ if (req.request !~ "<%= @allowed_methods %>"
&& !(req.request == "OPTIONS" && req.http.Origin)) {
/* We only deal with GET, HEAD and POST by default */
error 403 "HTTP method not allowed.";
--
To view, visit https://gerrit.wikimedia.org/r/109330
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iea96bbedd8f351e3452f0dc2aaf3a9d42d78b165
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: BryanDavis <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits