Mark Bergsma has uploaded a new change for review.

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


Change subject: Add max-age/s-maxage on CC: private/no-cache responses
......................................................................

Add max-age/s-maxage on CC: private/no-cache responses

Varnish does not respect Cache-Control: private or no-cache,
supposedly because "Varnish is not a cache in the RFC2616" sense.
https://www.varnish-cache.org/trac/ticket/1124

Change-Id: I19167342de721530a1968c20779418a73dd3143d
---
M modules/varnish/templates/vcl/wikimedia.vcl.erb
1 file changed, 6 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/06/76906/1

diff --git a/modules/varnish/templates/vcl/wikimedia.vcl.erb 
b/modules/varnish/templates/vcl/wikimedia.vcl.erb
index ea8afef..293c163 100644
--- a/modules/varnish/templates/vcl/wikimedia.vcl.erb
+++ b/modules/varnish/templates/vcl/wikimedia.vcl.erb
@@ -236,6 +236,12 @@
 }
 
 sub vcl_fetch {
+       /* Add max-age/s-maxage to CC to fix Varnish's broken behaviour */
+       if (beresp.http.Cache-Control !~ "(max-age|s-maxage)"
+               && beresp.http.Cache-Control ~ "(private|no-cache)") {
+               set beresp.http.Cache-Control = beresp.http.Cache-Control + ", 
s-maxage=0, max-age=0";
+       }
+
        set beresp.grace = 60m;
 
 <% if vcl_config.fetch("retry5xx", "0") == "1" -%>

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I19167342de721530a1968c20779418a73dd3143d
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