Closed leofeyer closed 7 years ago
I think it's the expected behavior: the cache middleware shouldn't have access to the parameters set by the app. That's the behavior of using eg Varnish as another middleware caching layer, we should not diverge from this reference.
Being as close as possible as a reverse proxy that would be in front of an app is indeed the goal here.
In the
HttpCache::fetch()
method does a$subRequest = clone $request;
and passes the$subRequest
variable to theforward()
method, so all the request attributes end up on the$subRequest
object instead of the$request
object.This causes the request object to be empty when passed to
$kernel->terminate($request, $response)
.Here is the request object without using the HTTP cache:
Is this the expected behavior when using the HTTP cache? Because some of our
kernel.terminate
event listeners need to read the request attributes. Also, it seems kind of inconsistent to me.