-- Kai Meder <[EMAIL PROTECTED]> wrote
(on Sunday, 13 April 2008, 02:01 AM +0200):
> 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?

Umm... ZF does *not* set any headers by default, and certainly not any
caching headers. Your culprit is most likely your Apache install.

> Secondly, I can`t properly set the Header 304, the client does not
> cache the images...

This *should* work in ZF -- we make use of the response code and raw
header accessors in the ErrorHandler plugin with no issues. Again, my
guess is that your web server is overriding this.

-- 
Matthew Weier O'Phinney
Software Architect       | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/

Reply via email to