4

I am using Apache 2.2.20. I set the expire_mod to be "access plus 5 minutes". I check the header using some website, and I am sure that in the header there did has an expire directory. However, when I use a tcpdump to monitor the network traffic, I still see the packet transfer when I reload the webpage using the Firefox, which should not be expired. Does anyone know the reason for this? Thanks.

skaffman
  • 398,947
  • 96
  • 818
  • 769
  • Show the configuration, show us the headers returned by Apache for an URL you think should trigger your mod_expires directives – fge Dec 21 '11 at 20:17
  • header returned:HTTP/1.1 200 OK Date: Wed, 21 Dec 2011 20:19:36 GMT Server: Apache/2.2.20 (Unix) DAV/2 Cache-Control: max-age=300 Expires: Wed, 21 Dec 2011 20:24:36 GMT Content-Type: text/html;charset=UTF-8 – runnnnnnnnn Dec 21 '11 at 20:20
  • I added the following line to the config file. ExpiresActive On ExpiresDefault "access plus 5 minutes" – runnnnnnnnn Dec 21 '11 at 20:21
  • OK, so your server is configured correctly (`Cache-Control` is present) – fge Dec 21 '11 at 21:04

1 Answers1

2

When you hit the "reload" button of your browser, the browser assumes that it should try and reload all elements of the page.

You have mod_expires configured correctly. However, this won't stop the browser trying: when you hit the reload button, a request for each element will be sent anyway, with a If-Modified-Since header, but since, on the Apache side, it hasn't been modified, Apache will return a 304 Not modified.

So, you do see traffic, just not a full page reload. You can witness this with the same tool you used to capture the headers to confirm keepalive is working (and by the way, a 5 minutes max-age is low).

fge
  • 119,121
  • 33
  • 254
  • 329