BBlack has submitted this change and it was merged.

Change subject: varnish: standardize/de-duplicate do_gzip
......................................................................


varnish: standardize/de-duplicate do_gzip

This standardizes our do_gzip stanza across the text, mobile, and
upload clusters via wikimedia.vcl.erb.  For text and mobile, the
net change is that it's applied at both layers instead of just the
frontend (more efficient).  Upload switches from backend-only to
both layers (very little change in practice), and switches from
only compressing SVGs to also compressing icons like the others
(probably doesn't matter, just better to have everything aligned).

Bug: T96847
Change-Id: I66c708c03675f3b976f7deda519daa92b01c8b9d
---
M modules/varnish/templates/vcl/wikimedia.vcl.erb
M templates/varnish/mobile-frontend.inc.vcl.erb
M templates/varnish/text-frontend.inc.vcl.erb
M templates/varnish/upload-backend.inc.vcl.erb
4 files changed, 7 insertions(+), 20 deletions(-)

Approvals:
  Krinkle: Looks good to me, but someone else must approve
  BBlack: Verified; Looks good to me, approved



diff --git a/modules/varnish/templates/vcl/wikimedia.vcl.erb 
b/modules/varnish/templates/vcl/wikimedia.vcl.erb
index 8d989a1..933d4eb 100644
--- a/modules/varnish/templates/vcl/wikimedia.vcl.erb
+++ b/modules/varnish/templates/vcl/wikimedia.vcl.erb
@@ -465,6 +465,13 @@
 <% end -%>
        set beresp.grace = 60m;
 
+<% if @vcl_config.fetch("do_gzip", false) -%>
+       // Compress ico and SVG files
+       if (beresp.http.content-type ~ 
"^image/(x-icon|vnd\.microsoft\.icon|svg\+xml)$") {
+               set beresp.do_gzip = true;
+       }
+<% end -%>
+
        /* Function vcl_fetch in <%= @vcl %>.inc.vcl will be appended here */
 }
 
diff --git a/templates/varnish/mobile-frontend.inc.vcl.erb 
b/templates/varnish/mobile-frontend.inc.vcl.erb
index f179588..5c73b50 100644
--- a/templates/varnish/mobile-frontend.inc.vcl.erb
+++ b/templates/varnish/mobile-frontend.inc.vcl.erb
@@ -117,13 +117,6 @@
                return (hit_for_pass);
        }
 
-<% if @vcl_config.fetch("do_gzip", false) -%>
-       // Compress ico and SVG files
-       if (beresp.http.content-type ~ 
"^image/(x-icon|vnd\.microsoft\.icon|svg\+xml)$") {
-               set beresp.do_gzip = true;
-       }
-<% end -%>
-
        return (deliver);
 }
 
diff --git a/templates/varnish/text-frontend.inc.vcl.erb 
b/templates/varnish/text-frontend.inc.vcl.erb
index 7cbd0ed..e311212 100644
--- a/templates/varnish/text-frontend.inc.vcl.erb
+++ b/templates/varnish/text-frontend.inc.vcl.erb
@@ -123,13 +123,6 @@
                return (hit_for_pass);
        }
 
-<% if @vcl_config.fetch("do_gzip", false) -%>
-       // Compress ico and SVG files
-       if (beresp.http.content-type ~ 
"^image/(x-icon|vnd\.microsoft\.icon|svg\+xml)$") {
-               set beresp.do_gzip = true;
-       }
-<% end -%>
-
        return (deliver);
 }
 
diff --git a/templates/varnish/upload-backend.inc.vcl.erb 
b/templates/varnish/upload-backend.inc.vcl.erb
index 016ad25..5bad940 100644
--- a/templates/varnish/upload-backend.inc.vcl.erb
+++ b/templates/varnish/upload-backend.inc.vcl.erb
@@ -64,12 +64,6 @@
                set beresp.http.X-MediaWiki-Original = regsub(req.url, 
"^(/+[^/]+/[^/]+/)thumb/([^/]+/[^/]+/[^/]+).*$", "\1\2");
        }
 
-<% if @vcl_config.fetch("do_gzip", false) -%>
-       if (beresp.http.content-type == "image/svg+xml") {
-               set beresp.do_gzip = true;
-       }
-<% end -%>
-
        return (deliver);
 }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I66c708c03675f3b976f7deda519daa92b01c8b9d
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: BBlack <bbl...@wikimedia.org>
Gerrit-Reviewer: BBlack <bbl...@wikimedia.org>
Gerrit-Reviewer: Faidon Liambotis <fai...@wikimedia.org>
Gerrit-Reviewer: Krinkle <krinklem...@gmail.com>
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

Reply via email to