Skip to content
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

[HttpKernel] Fix response always private and overwritten if session is started #27282

Closed
wants to merge 2 commits into from

Conversation

stixx
Copy link

@stixx stixx commented May 16, 2018

Q A
Branch? 3.4
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #26769
License MIT

This PR resolves the bug where the response caching directives where always overwritten in the master request by the listener even if the controller response was trying to set caching directives. This fix adds an additional check in the listener to check if the response was cacheable at first.

@nicolas-grekas
Copy link
Member

This has been solved differently in #26681: the current behavior is considered correct (see links in linked PR), yet in very specific cases (e.g. session groups) it's OK to cache session accessing data. Thus 4.1 will provide a way to force caching session-using responses, as a new feature.

@nicolas-grekas nicolas-grekas added this to the next milestone May 18, 2018
@stixx
Copy link
Author

stixx commented May 21, 2018

That solution isn't available yet in Symfony 3.4 as far as I can see. What do you require for this solution to come for 3.4?:

@nicolas-grekas
Copy link
Member

#26681 is a new feature, so cannot go on 3.4. Options 1. or 2. are the ones.

@stixx stixx closed this May 21, 2018
@HypeMC
Copy link
Contributor

HypeMC commented May 23, 2018

@nicolas-grekas I'm really disappointed to hear this. I just upgraded Symfony from 3.3 to 3.4 & ESI caching completely stopped working. I understand that no new features will be added to 3.4 anymore, but this seems to go against the BC promise. Would be great if some fix was provided for 3.x. Dunno, maybe I'm wrong about the BC promise, but it looks like a big change for a minor version.

@EmmanuelVella
Copy link
Contributor

@nicolas-grekas From symfony 3.4, current doc won't work if the firewall is enabled on theses actions (http://symfony.com/doc/3.4/http_cache/esi.html).

So what is the way to make it work in this case ? Excluding corresponding actions in the security.yml file ? This would be hard to maintain when having, for example, many actions and using i18n routes.

@nicolas-grekas
Copy link
Member

nicolas-grekas commented Jun 4, 2018

@EmmanuelVella if you mean having cached fragments while using HttpCache, there is a PR fixing it in #27467 when the fragments don't use the session. If you mean having cached fragments behind a stateful firewall, then most of the time these are not cacheable. At least they cannot be considered cacheable by default yes.

@nicolas-grekas nicolas-grekas modified the milestones: next, 4.2 Nov 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants