Open
Description
Symfony version(s) affected
7.1.0
Description
Cache attribute's vary
property is silently ignored with following config:
framework:
set_locale_from_accept_language: true
And following controller
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpKernel\Attribute\Cache;
class SomeController
{
#[Cache(smaxage: 3600, vary: ['X-Some-Header'])]
public function index(): Response
{
return new JsonResponse("OK");
}
}
The LocaleListener adds an attribute to the request that is used by the ResponseListener to add a Vary: Accept-Language
header.
However, this occurs before the CacheAttributeListener, which doesn't take the attribute's vary
property into account if there is already a Vary
header on the response.
Is this expected?
How to reproduce
See above.
Possible Solution
No response
Additional Context
No response