[master] 81006ea Handle Cache-control: (private|no-cache|no-store) by default

Tollef Fog Heen tfheen at varnish-cache.org
Mon Feb 4 14:50:57 CET 2013


commit 81006eafd6d4cd6f9481740a1d172e316a184d05
Author: Tollef Fog Heen <tfheen at varnish-software.com>
Date:   Mon Feb 4 14:43:22 2013 +0100

    Handle Cache-control: (private|no-cache|no-store) by default
    
    As per discussion at the Varnish dev meeting, seeing Cache-control:
    no-cache (and friends) now disable caching by default.  As a twist, we
    respect Surrogate-control if that is present, in the default VCL.
    
    Fixes: 1124
    References: 477

diff --git a/bin/varnishd/default.vcl b/bin/varnishd/default.vcl
index bb78074..0e2031a 100644
--- a/bin/varnishd/default.vcl
+++ b/bin/varnishd/default.vcl
@@ -104,6 +104,9 @@ sub vcl_miss {
 sub vcl_fetch {
     if (beresp.ttl <= 0s ||
         beresp.http.Set-Cookie ||
+        beresp.http.Surrogate-control ~ "no-store" ||
+        (!beresp.http.Surrogate-Control &&
+          beresp.http.Cache-Control ~ "no-cache|no-store|private") ||
         beresp.http.Vary == "*") {
 		/*
 		 * Mark as "Hit-For-Pass" for the next 2 minutes



More information about the varnish-commit mailing list