title: Google Chrome audit on caching
body: <p>If I run an audit on my sites with Google Chrome, I get this message in the <em>Leverage browser caching</em> section:</p>
  
  <blockquote>
    <p>The following resources are missing a
    cache expiration. Resources that do
    not specify an expiration may not be
    cached by browsers:</p>
  </blockquote>
  
  <p>A list of all the pictures follows. I get a similar notice in <em>Leverage proxy caching</em>:</p>
  
  <blockquote>
    <p>Consider adding a "Cache-Control:
    public" header to the following
    resources:</p>
  </blockquote>
  
  <p>Apart from pictures, I also get a notice about HTML, CSS and JavaScript files:</p>
  
  <blockquote>
    <p>The following resources are explicitly
    non-cacheable. Consider making them
    cacheable if possible:</p>
  </blockquote>
  
  <p>Its funny because I've worked hard to cache all static contents (except for pictures, where I just left Apache's default settings). Firefox does indeed store all these items in cache.</p>
  
  <p>Is there anything I should improve in my HTTP headers?</p>
  
  <hr>
  
  <p>Here's the complete header set of some items as loaded after removing the browser caché. Pictures use default settings I didn't really check before, the rest should be cachéd for three hours. I can set headers with both <code>.htaccess</code> and <code>PHP</code>.</p>
  
  <h1>PNG</h1>
  
  <pre><code>HTTP/1.1 200 OK
  Date: Sat, 31 Jul 2010 12:46:14 GMT
  Server: Apache
  Last-Modified: Thu, 18 Mar 2010 21:40:54 GMT
  Etag: "c48024-230-4821a15d6c580"
  Accept-Ranges: bytes
  Content-Length: 560
  Keep-Alive: timeout=4
  Connection: Keep-Alive
  Content-Type: image/png
  </code></pre>
  
  <h1>HTML</h1>
  
  <pre><code>HTTP/1.1 200 OK
  Date: Sat, 31 Jul 2010 12:46:13 GMT
  Server: Apache
  X-Powered-By: PHP/5.2.11
  Expires: Sat, 31 Jul 2010 15:46:13 GMT
  Cache-Control: max-age=10800, s-maxage=10800, must-revalidate, proxy-revalidate
  Content-Encoding: gzip
  Vary: Accept-Encoding
  Last-Modified: Wed, 24 Mar 2010 20:30:36 GMT
  Keep-Alive: timeout=4
  Connection: Keep-Alive
  Transfer-Encoding: chunked
  Content-Type: text/html; charset=ISO-8859-15
  </code></pre>
  
  <h1>CSS</h1>
  
  <pre><code>HTTP/1.1 200 OK
  Date: Sat, 31 Jul 2010 12:48:21 GMT
  Server: Apache
  X-Powered-By: PHP/5.2.11
  Expires: Sat, 31 Jul 2010 15:48:21 GMT
  Cache-Control: max-age=10800, s-maxage=10800, must-revalidate, proxy-revalidate
  Content-Encoding: gzip
  Vary: Accept-Encoding
  Last-Modified: Thu, 18 Mar 2010 21:40:12 GMT
  Keep-Alive: timeout=4
  Connection: Keep-Alive
  Transfer-Encoding: chunked
  Content-Type: text/css
  </code></pre>
  
  <h1>JavaScript</h1>
  
  <pre><code>HTTP/1.1 200 OK
  Date: Sat, 31 Jul 2010 12:48:21 GMT
  Server: Apache
  X-Powered-By: PHP/5.2.11
  Expires: Sat, 31 Jul 2010 15:48:21 GMT
  Cache-Control: max-age=10800, s-maxage=10800, must-revalidate, proxy-revalidate
  Content-Encoding: gzip
  Vary: Accept-Encoding
  Last-Modified: Thu, 18 Mar 2010 21:40:12 GMT
  Keep-Alive: timeout=4
  Connection: Keep-Alive
  Transfer-Encoding: chunked
  Content-Type: application/x-javascript
  </code></pre>
  
  <hr>
  
  <h1>Update</h1>
  
  <p>I've tested Jumby's suggestion and set my CSS's expire to 1 year:</p>
  
  <pre><code>Cache-Control:max-age=31536000, s-maxage=31536000, must-revalidate, proxy-revalidate
  Connection:Keep-Alive
  Content-Encoding:gzip
  Content-Length:4198
  Content-Type:text/css
  Date:Mon, 02 Aug 2010 20:48:56 GMT
  Expires:Tue, 02 Aug 2011 20:48:56 GMT
  Keep-Alive:timeout=5, max=99
  Last-Modified:Thu, 18 Mar 2010 20:40:12 GMT
  Server:Apache/2.2.14 (Win32) PHP/5.3.1
  Vary:Accept-Encoding
  X-Powered-By:PHP/5.3.1
  </code></pre>
  
  <p>However, Chrome still claims "<em>explicitly non-cacheable</em>".</p>