title: Cache-Control Header Modified By PHP Session?
body: <p>I'm outputting an image to the browser using a <code>Zend_Controller_Response</code> object.  It is my intention to apply caching to the image, however something is causing the Cache-Control header to be overwritten.</p>
  
  <p>My code is as follows:</p>
  
  <pre><code>$this-&gt;getResponse()
      -&gt;setHeader('Last-Modified', $modifiedTime, true)
      -&gt;setHeader('ETag', md5($modifiedTime), true)
      -&gt;setHeader('Expires', $expires, true)
      -&gt;setHeader('Pragma', '', true)
      -&gt;setHeader('Cache-Control', 'max-age=3600')
      -&gt;setHeader('Content-Type', $mimeType, true)
      -&gt;setHeader('Content-Length', $size, true)
      -&gt;setBody($data);
  </code></pre>
  
  <p>The output (as viewed in Firebug) is:</p>
  
  <p><strong>Response Headers</strong></p>
  
  <blockquote>
  <dl>
  <dt>Date</dt><dd>Wed, 25 Mar 2009 10:34:40 GMT</dd>
  <dt>Server</dt><dd>Apache/2.2.3 (Ubuntu) mod_ssl/2.2.3 OpenSSL/0.9.8c</dd>
  <dt>Expires</dt><dd>Thu, 26 Mar 2009 10:34:41 GMT</dd>
  <dt>Cache-Control</dt><dd>no-store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=3600</dd>
  <dt>Last-Modified</dt><dd>1234872514</dd>
  <dt>Etag</dt><dd>d3ef646c640b689b0101f3e03e08a524</dd>
  <dt>Content-Length</dt><dd>1452</dd>
  <dt>X-UA-Compatible</dt><dd>IE=EmulateIE7</dd>
  <dt>X-Robots-Tag</dt><dd>noindex</dd>
  <dt>Keep-Alive</dt><dd>timeout=15, max=100</dd>
  <dt>Connection</dt><dd>Keep-Alive</dd>
  <dt>Content-Type</dt><dd>image/jpeg</dd>
  </dl>
  </blockquote>
  
  <p><strong>Request Headers</strong></p>
  
  <blockquote>
  <dl>
  <dt>Host</dt><dd>khall.####.###.######.com</dd>
  <dt>User-Agent</dt><dd>Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.7) Gecko/2009030422 Ubuntu/8.04 (hardy) Firefox/3.0
  .7</dd>
  <dt>Accept</dt><dd>text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8</dd>
  <dt>Accept-Language</dt><dd>en-gb,en;q=0.5</dd>
  <dt>Accept-Encoding</dt><dd>gzip,deflate</dd>
  <dt>Accept-Charset</dt><dd>ISO-8859-1,utf-8;q=0.7,*;q=0.7</dd>
  <dt>Keep-Alive</dt><dd>300</dd>
  <dt>Connection</dt><dd>keep-alive</dd>
  <dt>Referer</dt><dd>http://khall.####.###.######.com/</dd>
  <dt>Cookie</dt><dd>PHPSESSID=abf5056e1289d3010448107632a1c1bd</dd>
  </dl>
  </blockquote>
  
  <p>As you can see, the cache control is modified to include: </p>
  
  <blockquote>
    <p>no-store, no-cache, must-revalidate, post-check=0, pre-check=0</p>
  </blockquote>
  
  <p>My suspicion is towards the session cookie being sent in the request.  Does anybody know a way to send the header that I require, yet still keep the session in the request?  My application is run through a bootstrap, and sessions are handled using Zend_Session.</p>
  
  <p>Any help would be appreciated.</p>