Ori.livneh has uploaded a new change for review.

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

Change subject: Handle 204s consistently across Varnish roles
......................................................................

Handle 204s consistently across Varnish roles

Handle requests to beacon endpoints (/event.gif, /statsv, /beacon) with an HTTP
204 across all Varnish roles, not just bits.

Change-Id: Ie6258f74fdd9c8e107b977581f41eaeb9e9d0b61
Task: T95448
---
M modules/varnish/templates/vcl/wikimedia.vcl.erb
1 file changed, 20 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/51/206351/1

diff --git a/modules/varnish/templates/vcl/wikimedia.vcl.erb 
b/modules/varnish/templates/vcl/wikimedia.vcl.erb
index 827b3ab..926dc4e 100644
--- a/modules/varnish/templates/vcl/wikimedia.vcl.erb
+++ b/modules/varnish/templates/vcl/wikimedia.vcl.erb
@@ -297,6 +297,22 @@
                error 200 "OK"; 
        }
 
+        if (req.url ~ "^/(event\.gif|beacon\/[^/?]+|statsv[/?])") {
+                // Logging beacon endpoints
+                //
+                // They are handled by log tailers (varnishkafka and 
varnishncsa) that filter the
+                // Varnish shm log for reqs to these endpoints and forward 
them to log processors
+                // for storage and analysis.
+                //
+                // * /event.gif is used by EventLogging (owner: analytics)
+                // * /statsv is used by MediaWiki for statsd-like performance 
metrics (owner: Ori)
+                // * /beacon/ is used by all other applications.
+                //
+                // If you need a custom endpoint, don't modify this regex. 
Tack on a path component
+                // to /beacon to claim a namespace instead -- e.g.: 
/beacon/images?...
+                error 204;
+        }
+
        /* Function vcl_recv in <%= @vcl %>.inc.vcl will be appended here */
 }
 
@@ -387,8 +403,11 @@
                return(restart);
        }
 <% end -%>
-       if (obj.status == 204 && req.request == "PURGE") {
+       if (obj.status == 204) {
                set obj.http.Connection = "keep-alive";
+               if (req.request != "PURGE") {
+                       return (deliver);  // 204 responses shouldn't contain a 
body
+               }
        }
        /* Function vcl_error in <%= @vcl %>.inc.vcl will be appended here */
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie6258f74fdd9c8e107b977581f41eaeb9e9d0b61
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ori.livneh <o...@wikimedia.org>

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

Reply via email to