willdurand / BazingaJsTranslationBundle

A pretty nice way to expose your Symfony translation messages to your client applications.
MIT License
572 stars 178 forks source link

No Cache #340

Open obernado opened 1 year ago

obernado commented 1 year ago

I'm not sure why but Symfony is not caching the calls to translations. Modifying the http_cache_time parameters seems to have no effect. Could it be that when building the response on getTranslationsAction this line should be added? $response->headers->set(AbstractSessionListener::NO_AUTO_CACHE_CONTROL_HEADER, 'true'); https://symfony.com/doc/current/http_cache.html#http-caching-and-user-sessions I can make a PR with that if its okay.

I read the related issue https://github.com/willdurand/BazingaJsTranslationBundle/issues/297 but didn't work.

stof commented 6 months ago

Make sure your stateful firewall is not active on the path of the translations, so that the security system does not use the session on those URLs.