Mark Bergsma has uploaded a new change for review. https://gerrit.wikimedia.org/r/79782
Change subject: Make sure that responses with any of private, no-cache, no-store are never cached ...................................................................... Make sure that responses with any of private, no-cache, no-store are never cached Previously, if a response was sent with: Cache-Control: private, max-age=300 Varnish would still cache this object for 5 minutes. Change-Id: Ie64400bd1a8f64dc9d69b5c9588a1b01ccaa8fe0 --- M modules/varnish/templates/vcl/wikimedia.vcl.erb 1 file changed, 8 insertions(+), 11 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/82/79782/1 diff --git a/modules/varnish/templates/vcl/wikimedia.vcl.erb b/modules/varnish/templates/vcl/wikimedia.vcl.erb index ad4a34b..278bd16 100644 --- a/modules/varnish/templates/vcl/wikimedia.vcl.erb +++ b/modules/varnish/templates/vcl/wikimedia.vcl.erb @@ -237,23 +237,20 @@ } 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)") { + /* Don't cache private, no-cache, no-store objects */ + if (beresp.http.Cache-Control ~ "(private|no-cache|no-store)") { set beresp.ttl = 0s; - set beresp.http.Cache-Control = beresp.http.Cache-Control + ", s-maxage=0, max-age=0"; + /* This should be translated into hit_for_pass later */ } - - set beresp.grace = 60m; - + elsif (beresp.status >= 400 && beresp.status <= 499 && beresp.ttl > <%= vcl_config.fetch("cache4xx", "5m") %>) { + set beresp.ttl = <%= vcl_config.fetch("cache4xx", "5m") %>; + } <% if vcl_config.fetch("retry5xx", "0") == "1" -%> - if (beresp.status > 499 && beresp.status < 505) { + if (beresp.status >= 500 && beresp.status < 505) { return(restart); } <% end -%> - if (beresp.status >= 400 && beresp.ttl > <%= vcl_config.fetch("cache4xx", "5m") %>) { - set beresp.ttl = <%= vcl_config.fetch("cache4xx", "5m") %>; - } + set beresp.grace = 60m; /* Function vcl_fetch in <%= vcl %>.inc.vcl will be appended here */ } -- To view, visit https://gerrit.wikimedia.org/r/79782 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie64400bd1a8f64dc9d69b5c9588a1b01ccaa8fe0 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