You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bug #61368 [HttpKernel] Refine Vary header check to skip special handling of 'Accept-Language' when it's the only entry and '_vary_by_language' is true in CacheAttributeListener (santysisi)
This PR was merged into the 6.4 branch.
Discussion
----------
[HttpKernel] Refine Vary header check to skip special handling of 'Accept-Language' when it's the only entry and '_vary_by_language' is `true` in `CacheAttributeListener`
| Q | A
| ------------- | ---
| Branch? | 6.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Issues | Fix #61229
| License | MIT
### Summary
Refine Vary header check to skip special handling of 'Accept-Language' when it's the only entry and '_vary_by_language' is true in CacheAttributeListener
### Reason
Previously, the `CacheAttributeListener` was executed after the `ResponseListener`. When the `set_locale_from_accept_language` option is enabled in `framework.yaml`, the `ResponseListener` sets a Vary header on the response. Because `CacheAttributeListener` checks if a Vary header already exists before modifying it, its logic was being bypassed if it ran after the `ResponseListener`.
### References
* [LocaleListener](https://github.com/symfony/symfony/blob/6.4/src/Symfony/Component/HttpKernel/EventListener/LocaleListener.php#L69-L76)
* [ResponseListener](https://github.com/symfony/symfony/blob/6.4/src/Symfony/Component/HttpKernel/EventListener/ResponseListener.php#L55-L57)
* [CacheAttributeListener](https://github.com/symfony/symfony/blob/6.4/src/Symfony/Component/HttpKernel/EventListener/CacheAttributeListener.php#L126)
Commits
-------
fa2bcbe6dec [HttpKernel] Refine Vary header check to skip special handling of 'Accept-Language' when it's the only entry and '_vary_by_language' is `true` in `CacheAttributeListener`
0 commit comments