Faidon Liambotis has submitted this change and it was merged. Change subject: varnish: allow POST for EventLogging on bits ......................................................................
varnish: allow POST for EventLogging on bits The sendBeacon W3C API works by issuing POSTs to EventLogging URLs. Currently, we issue a "method not allowed" on POSTs; while that would still work with EventLogging (as neither the browser nor EL would care about the status code), this would elevate our error statistics. Handle this case by moving the conditional block and thus allowing POSTs specifically for event.gif. RT: 8612 Change-Id: I7d752d1fe84620ed64101d6bece7631057a8a3e6 --- M templates/varnish/bits.inc.vcl.erb 1 file changed, 5 insertions(+), 4 deletions(-) Approvals: Ori.livneh: Looks good to me, but someone else must approve Nuria: Looks good to me, but someone else must approve Faidon Liambotis: Looks good to me, approved jenkins-bot: Verified diff --git a/templates/varnish/bits.inc.vcl.erb b/templates/varnish/bits.inc.vcl.erb index 769f5e4..3d962cf 100644 --- a/templates/varnish/bits.inc.vcl.erb +++ b/templates/varnish/bits.inc.vcl.erb @@ -23,7 +23,10 @@ <% end -%> sub vcl_recv { - /* Since we are allowing POST at wikimedia3.vcl.erb, disallow here */ + if (req.url ~ "^/event\.gif") { + error 204; + } + if (req.request == "POST") { error 403 "HTTP method not allowed."; } @@ -41,15 +44,13 @@ } if (req.http.host == "<%= cluster_options.fetch( "bits_domain", "bits.wikimedia.org" )%>") { - if (req.url ~ "^/event\.gif") { - error 204; - } /* For https-only wikis, the redirect from http to https for bits assets should occur in varnish instead of apache, since the apache redirect and mediawiki doesn't vary by protocol. This can result in a redirect loop and assets not loading. */ if ( req.url ~ "^/(auditcom|boardgovcom|board|chair|chapcom|checkuser|collab|donate|exec|fdc|grants|internal|movementroles|nomcom|office|otrs-wiki|searchcom|spcom|steward|wikimaniateam)\.wikimedia\.org/" && req.http.X-Forwarded-Proto != "https" ) { error 301 "https://<%= cluster_options.fetch( "bits_domain", "bits.wikimedia.org" )%>" + req.url; } + <% if cluster_options.fetch( "enable_geoiplookup", false ) -%> if (req.url == "/geoiplookup") { error 666 "geoiplookup"; -- To view, visit https://gerrit.wikimedia.org/r/170883 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7d752d1fe84620ed64101d6bece7631057a8a3e6 Gerrit-PatchSet: 5 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Faidon Liambotis <fai...@wikimedia.org> Gerrit-Reviewer: BBlack <bbl...@wikimedia.org> Gerrit-Reviewer: Faidon Liambotis <fai...@wikimedia.org> Gerrit-Reviewer: Nuria <nu...@wikimedia.org> Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits