Hello,
I do want an ImageService to get cached by the client.
$ETag = md5($h);
$this->res
->setHeader('Cache-Control', 'public', true)
->setHeader('Pragma', 'public', true)
->setHeader('Expires', gmdate("D, d M Y H:i:s",
time()+3600*24*365).' GMT', true)
->setHeader('ETag', $ETag, true);
if (isset($_SERVER['HTTP_IF_NONE_MATCH']) &&
$_SERVER['HTTP_IF_NONE_MATCH'] == $ETag) {
//header('HTTP/1.1 304 Not Modified');
//$this->res->setHttpResponseCode(304);
$this->res->setRawHeader('HTTP/1.1 304 Not Modified');
return true;
}
This does not work. I think the Cache-Control, Pragma and Expires
headers, which seem to have been manually set by the Zend-Framework, do
affect the Cache-Behavior.
I can`t remove them, so is my overwriting OK to enforce the Browser to
cache?
Secondly, I can`t properly set the Header 304, the client does not cache
the images...
Any Hints?
Thanks,
Kai