[HttpKernel] HttpCache now sends maxage=0 cache-control directive in case of Esi presence.
This commit is contained in:
parent
bebdcb242d
commit
ea4ab77b6d
@ -180,7 +180,7 @@ class HttpCache implements HttpKernelInterface
|
|||||||
*/
|
*/
|
||||||
protected function addEsiTtl(Response $response)
|
protected function addEsiTtl(Response $response)
|
||||||
{
|
{
|
||||||
$this->esiTtls[] = $response->isValidateable() ? 0 : $response->getTtl();
|
$this->esiTtls[] = $response->isValidateable() ? -1 : $response->getTtl();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -192,10 +192,11 @@ class HttpCache implements HttpKernelInterface
|
|||||||
protected function updateResponseCacheControl(Response $response)
|
protected function updateResponseCacheControl(Response $response)
|
||||||
{
|
{
|
||||||
$ttl = min($this->esiTtls);
|
$ttl = min($this->esiTtls);
|
||||||
if (0 === $ttl) {
|
if (-1 === $ttl) {
|
||||||
$response->headers->set('Cache-Control', 'no-cache, must-revalidate');
|
$response->headers->set('Cache-Control', 'no-cache, must-revalidate');
|
||||||
} else {
|
} else {
|
||||||
$response->setSharedMaxAge($ttl);
|
$response->setSharedMaxAge($ttl);
|
||||||
|
$response->setMaxAge(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user