I’m trying to cache a profile user page. For this, I use :
$response = new Response();
$response->setETag(md5($response->getContent()));
if ($response->isNotModified($this->getRequest())) {
return $response;
}
But, the application never use the cache because $this->getRequest()->getEtags() (which use in isNotModified function) is always empty. If I set
$response->setPublic()
All is ok. So, how can I use caching in Private context ?
Thx !
When using private response in Symfony 2, it sets the following header:
According to the HTTP 1/1 specification:
That means that you CAN’T use
ETagheader withCache-Control: private.