Skip to content

Commit 3293286

Browse files
committed
feature #4801 [Cookbook][cache][varnish] be more precise about version differences (dbu)
This PR was merged into the 2.3 branch. Discussion ---------- [Cookbook][cache][varnish] be more precise about version differences | Q | A | ------------- | --- | Doc fix? | no | New docs? | no | Applies to | all | Fixed tickets | - Found this page while trying to figure out what exactly the defaults of varnish are, and realized I was not precise yet. Commits ------- dc2829c [varnish] be more precise about version differences
2 parents bcf1508 + dc2829c commit 3293286

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

cookbook/cache/varnish.rst

+14-5
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,9 @@ Ensure Consistent Caching Behaviour
6565

6666
Varnish uses the cache headers sent by your application to determine how
6767
to cache content. However, versions prior to Varnish 4 did not respect
68-
``Cache-Control: no-cache``. To ensure consistent behaviour, use the following
69-
configuration if you are still using Varnish 3:
68+
``Cache-Control: no-cache``, ``no-store`` and ``private``. To ensure
69+
consistent behavior, use the following configuration if you are still
70+
using Varnish 3:
7071

7172
.. configuration-block::
7273

@@ -76,13 +77,19 @@ configuration if you are still using Varnish 3:
7677
/* By default, Varnish3 ignores Cache-Control: no-cache and private
7778
https://www.varnish-cache.org/docs/3.0/tutorial/increasing_your_hitrate.html#cache-control
7879
*/
79-
if (beresp.http.Cache-Control ~ "no-cache" ||
80-
beresp.http.Cache-Control ~ "private"
80+
if (beresp.http.Cache-Control ~ "private" ||
81+
beresp.http.Cache-Control ~ "no-cache" ||
82+
beresp.http.Cache-Control ~ "no-store"
8183
) {
8284
return (hit_for_pass);
8385
}
8486
}
8587
88+
.. tip::
89+
90+
You can see the default behavior of Varnish in the form of a VCL file:
91+
`default.vcl`_ for Varnish 3, `builtin.vcl`_ for Varnish 4.
92+
8693
Enable Edge Side Includes (ESI)
8794
-------------------------------
8895

@@ -143,7 +150,7 @@ Symfony adds automatically:
143150
.. tip::
144151

145152
If you followed the advice about ensuring a consistent caching
146-
behaviour, those vcl functions already exist. Just append the code
153+
behavior, those vcl functions already exist. Just append the code
147154
to the end of the function, they won't interfere with each other.
148155

149156
.. index::
@@ -172,3 +179,5 @@ proxy before it has expired, it adds complexity to your caching setup.
172179
.. _`Surrogate-Capability Header`: http://www.w3.org/TR/edge-arch
173180
.. _`cache invalidation`: http://tools.ietf.org/html/rfc2616#section-13.10
174181
.. _`FOSHttpCacheBundle`: http://foshttpcachebundle.readthedocs.org/
182+
.. _`default.vcl`: https://www.varnish-cache.org/trac/browser/bin/varnishd/default.vcl?rev=3.0
183+
.. _`builtin.vcl`: https://www.varnish-cache.org/trac/browser/bin/varnishd/builtin.vcl?rev=4.0

0 commit comments

Comments
 (0)