From 9c6197e7fa9d90192c221b05d02695e575cb9305 Mon Sep 17 00:00:00 2001 From: Ayyoub Afwallah <64936175+ayyoub-afwallah@users.noreply.github.com> Date: Sun, 23 Nov 2025 21:33:35 +0100 Subject: [PATCH 1/2] Clarify `#[Cache]` attribute precedence behavior Adds tip explaining that #[Cache] attribute doesn't override manually set headers. Related to #62488 --- http_cache.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/http_cache.rst b/http_cache.rst index 7e886b022d..3cd2babb6b 100644 --- a/http_cache.rst +++ b/http_cache.rst @@ -239,6 +239,10 @@ Thanks to this new code, your HTTP response will have the following header: Cache-Control: public, maxage=3600, must-revalidate +.. tip:: + + When both are used, the cache headers defined in the controller take precedence over those configured with the `#[Cache]` attribute. + This tells your HTTP reverse proxy to cache this response for 3600 seconds. If *anyone* requests this URL again before 3600 seconds, your application *won't* be hit at all. If you're using the Symfony reverse proxy, look at the ``X-Symfony-Cache`` header From 491e435564da87f12bcbe7d131b987abc3419362 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 25 Nov 2025 08:11:45 +0100 Subject: [PATCH 2/2] Minor tweak --- http_cache.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/http_cache.rst b/http_cache.rst index 3cd2babb6b..3c4421f555 100644 --- a/http_cache.rst +++ b/http_cache.rst @@ -241,7 +241,8 @@ Thanks to this new code, your HTTP response will have the following header: .. tip:: - When both are used, the cache headers defined in the controller take precedence over those configured with the `#[Cache]` attribute. + When both are used, the cache headers defined in the controller take + precedence over those configured with the ``#[Cache]`` attribute. This tells your HTTP reverse proxy to cache this response for 3600 seconds. If *anyone* requests this URL again before 3600 seconds, your application *won't* be hit at all.