-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Symfony 4 : Response head auto add private and max-age=0. How to fix it ? #25826
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
As soon as the session is used once anywhere to generate a response, it becomes non cache able. |
I did some debugging on the same problem today with symfony 3.4.3 to find out where my session is started. I found that the session is always added to the request by the AbstractSessio 8000 nListener See symfony/src/Symfony/Component/HttpKernel/EventListener/AbstractSessionListener.php Line 40 in 1df45e4
In RequestDataCollector::onKernelResponse then the session is always used to find out if the request is a redirect. https://github.com/symfony/symfony/blob/v3.4.0/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php#L319 So I think in my app I can never have a request without an active session. There is a fix for this in a commit from 10 days ago on the symfony 4 branch. 83f2579 |
@pixeltreiber your correct, this issue in |
@nicolas-grekas @fabpot It could be considered as a BC break. Before Symfony 3.4, my projects had HTTP caching even with a started session and now it doesn't. To fix the problem I have to do a big amount of work:
I understand this change but it should only be included in 4.0 IMO |
Why not sending a deprecation notice in Sf 3.4 instead of adding private cache header ? |
@nicolas-grekas So how can I use http cache for my API listings protected by oauth token ? |
Not all the page use session . so this function is not necessary !
The text was updated successfully, but these errors were encountered: