-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Unable to cache expensive requests that need Session #26242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@nicolas-grekas seeing as you mostly oversaw the changes in #25583 The problem I have with the change from #25583 is that besides what it describes it does it also does the following actions. ->setMaxAge(0)
->headers->addCacheControlDirective('must-revalidate'); In my opinion it is up to the implementation to determine if the request can be privately cached and requires revalidation. I am curious to hear why caching is completely disallowed. |
Duplicate of #26245? |
Could be, but from my limited understanding I would say it is different. This used to work. That was always broken? |
No this was "broken" with session refactoring. |
This is actually a duplicate of #26237, and is not a BC break, but a bugfix. |
closing as a duplicate of #26237 |
Well this issue is a bit different than mine. (#26237) I had the problem that i have actions which use the user and actions which do not. My fix was easy i separated the user needing and not needing actions within my security.yml, @christiaan has the problem that he wants to cache private responses, which the change breaks. In my opinion either the listener should not touch the cache headers if already private or the headers set should be configurable. OR even both options. Also that everything is in an abstract class does not help overwriting this any easier. |
@smurfy could you give me more details ? Can you give me the part of the security.yml ? Thanks ! |
Well i added all routes which needs auth to the patterns. This way only the routes matching the firewalls pattern actually start the session.
|
@smurfy It works, thank you very much ! |
Uh oh!
There was an error while loading. Please reload this page.
I have a controller that responds with a photo, the photo is private and the user needs to be authenticated and authorized to access it. The photo is encrypted and needs to be decrypted on each request. This is why I like the browser to cache the photo.
Using the following this used to work pre 3.4.3
In #25583 this behaviour has changed that if a session is started nothing can be cached.
I do understand that if the user logs out that the photo would still be in the browser cache but that is a risk I am willing to accept in turn for the huge performance boost.
How would I go about and implement this now?
The text was updated successfully, but these errors were encountered: