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

I believe you've asked this before. ZF does not send any custom headers
by default -- please check your apache settings, as they are most likely
coming from there.

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

We use the setRawHeader() and setHttpResponseCode() methods in the
ErrorController example in the manual, and it works fine. Again, my
suspicion is your web server configuration.

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

Reply via email to