Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dc2829c

Browse filesBrowse files
committed
[varnish] be more precise about version differences
1 parent 236c26f commit dc2829c
Copy full SHA for dc2829c

File tree

Expand file treeCollapse file tree

1 file changed

+14
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+14
-5
lines changed

‎cookbook/cache/varnish.rst

Copy file name to clipboardExpand all lines: cookbook/cache/varnish.rst
+14-5Lines changed: 14 additions & 5 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.