LiveHttpHeaders: what right cache management information

Using LiveHttpHeaders for Firefox 6, I tried to check if my JSS css files are cached using the Headers Module from Apache using htaccess. But I am confused, there are two values ​​from the "Cache-Control" data:

  GET /proz/css/global.css HTTP / 1.1
 Host: localhost
 User-Agent: Mozilla / 5.0 (Windows NT 5.1; rv: 5.0) Gecko / 20100101 Firefox / 5.0
 Accept: text / css, * / *; q = 0.1
 Accept-Language: en-us, en; q = 0.5
 Accept-Encoding: gzip, deflate
 Accept-Charset: ISO-8859-1, utf-8; q = 0.7, *; q = 0.7
 Connection: keep-alive
 Referer: http: // localhost / proz /
 Cookie: PHPSESSID = el34de37pe3bnp4rdtbst1kd43
 If-Modified-Since: Fri, 16 Sep 2011 21:15:32 GMT
 If-None-Match: "400000000b06a-2999-4ad157e5b4583"
 Cache-control: max-age = 0

 HTTP / 1.1 304 Not Modified
 Date: Sat, 17 Sep 2011 03:04:50 GMT
 Server: Apache / 2.2.17 (Win32) PHP / 5.2.8
 Connection: Keep-Alive
 Keep-Alive: timeout = 5, max = 99
 Etag: "400000000b06a-2999-4ad157e5b4583"
 Cache-control: max-age = 604800, public
 Vary: Accept-Encoding

Which one is the true data, the first Cache-Control data (max-age = 0) or the last.

I would also like to know how I can make sure that my JS, CSS, HTML files are compressed after using the deflate module in htaccess. And yes, both headers and deflate modules are included.

+1
firefox header cache-control
source share
1 answer

There are two parts to this list:

  • The part before the empty line is the request sent by your browser
  • The part after the empty line is the response sent by the server

Cache-Control: max-age=0 , sent by the client (your browser), tells the server (or any proxy in the middle) to send the latest version of the file. The browser usually sends this when you click the refresh button.

Cache-Control: max-age=604800, public sent by the server tells the client (your browser or proxy) that the file is valid for 604800 seconds and can be cached during this time. (The browser doesn’t even want to ask the server if a newer version exists if you don’t click the update, as in this case.)

The server responded with 304 Not Modified , which means that your browser already has the latest version and does not need to be downloaded again (it did not load it again).

The Vary: Accept-Encoding header indicates that the server made some decisions based on the client Accent-Encoding header. This may indicate that if the server did not respond with 304 Not Modified , it would compress the file.

To check this last point, clear your cache and request the file again and look at the contents of the Content-Encoding header (should be gzip or deflate if the data is compressed).

+5
source

All Articles