Skip to content

Commit 9c6197e

Browse files
ayyoub-afwallahjaviereguiluz
authored andcommitted
Clarify #[Cache] attribute precedence behavior
Adds tip explaining that #[Cache] attribute doesn't override manually set headers. Related to #62488
1 parent 643bc71 commit 9c6197e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

http_cache.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,10 @@ Thanks to this new code, your HTTP response will have the following header:
239239
240240
Cache-Control: public, maxage=3600, must-revalidate
241241
242+
.. tip::
243+
244+
When both are used, the cache headers defined in the controller take precedence over those configured with the `#[Cache]` attribute.
245+
242246
This tells your HTTP reverse proxy to cache this response for 3600 seconds. If *anyone*
243247
requests this URL again before 3600 seconds, your application *won't* be hit at all.
244248
If you're using the Symfony reverse proxy, look at the ``X-Symfony-Cache`` header

0 commit comments

Comments
 (0)