Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy does browser request file, even though Apache mod_expires is enabled?
    text
    copied!<p>I'm really confused by all that caching stuff. I'm trying to setup <code>mod_expires</code> to reduce the number of <code>HTTP Requests</code> from my website to the server.</p> <p>I did well so far, I installed <code>mod_expires</code> and wrote a little .conf file from the instructions on <a href="http://httpd.apache.org/docs/2.0/mod/mod_expires.html" rel="nofollow noreferrer">http://httpd.apache.org/docs/2.0/mod/mod_expires.html</a>.</p> <p>Now, for instance, all my <code>.png, .gif, .jpeg</code> files have a <code>Cache-Control</code> header. My expected result was, that the browser won't do any <code>GET Request</code> within the time period (given from the <code>Cache-Control</code> value). But it does, every single file fires a request and receives <code>HTTP 304 not Modified</code>.</p> <p>That is the wrong behavior isn't it ? It should load that files from the internal cache. One thing I don't understand is, that the browser sends a <code>Response header</code>: <code>Cache-Control: max-age=0</code>. Should it be like that?</p> <p>Here is an complete example <code>Request + Response headers</code> for a single <code>.png file</code>:</p> <p><strong>Request</strong></p> <pre><code>Host dev-mgg.localdomain User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 Accept image/png,image/*;q=0.8,*/*;q=0.5 Accept-Language de-de,de;q=0.8,en-us;q=0.5,en;q=0.3 Accept-Encoding gzip,deflate Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive 115 Connection keep-alive Referer http://dev-mgg.localdomain/css/global/icons.css?18224 Cookie IR_SQLPwdStore=; IR_SQLUser=sysadm If-Modified-Since Thu, 24 Jul 2008 06:24:11 GMT If-None-Match "4010127-3c4-452bf1aefd8c0" Cache-Control max-age=0 </code></pre> <p><strong>Response</strong></p> <pre><code>Date Mon, 02 Aug 2010 14:00:28 GMT Server Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny8 with Suhosin-Patch mod_perl/2.0.4 Perl/v5.10.0 Connection Keep-Alive Keep-Alive timeout=15, max=59 Etag "4010127-3c4-452bf1aefd8c0" Expires Mon, 02 Aug 2010 14:04:28 GMT Cache-Control max-age=240 </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload