0

I have a development vagrant box where I am updating some CSS. My CSS is being served to the browser via

<link rel="stylesheet" href="style.css?v=1439980743">

Where v=1439980743 is a timestamp of the file modification date. Although this value is changing correctly in the browser, apache is never served the new CSS. All browsers (Chrome, FF, IE) have the same behaviour and clearing the cache does not bring in the new CSS.

Fiddler is reporting code 200 that the file has successfully been received (rather than 304) but the file received is the older version of the CSS.

It is as if Apache is caching the old CSS and serving it up each time regardless of the actual file in the system.

The only way I can get the new CSS to be available is to rename the CSS file load the page in the browser (triggering a 404 error on the CSS) and then rename it back. On this next refresh the new CSS becomes available. Even an httpd restart does not allow the new file to be loaded.

Apache/2.2.3 CentOS release 5.10 (Final)

Does anyone know of any apache settings which could cause this?

Loaded modules

 core_module (static)
 mpm_prefork_module (static)
 http_module (static)
 so_module (static)
 alias_module (shared)
 authz_host_module (shared)
 autoindex_module (shared)
 dir_module (shared)
 env_module (shared)
 log_config_module (shared)
 mime_module (shared)
 negotiation_module (shared)
 setenvif_module (shared)
 php5_module (shared)
Andrew
  • 1,179
  • 8
  • 15
  • Unless you installed/activated additional caching modules, there is AFAIK no default functionality on Apache-level that would “cache” static files in that way. – CBroe Aug 19 '15 at 11:28
  • This is a vagrant box set up by someone who left a long time ago. I could not see anything obvious in the system setup, but have added the loaded modules in case that helps. – Andrew Aug 19 '15 at 12:49
  • Note: Added the following to httpd.conf and restarted httpd FileETag None Header unset ETag Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate" Header set Pragma "no-cache" Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT" Based on answer http://stackoverflow.com/questions/11532636/prevent-http-file-caching-in-apache-httpd-mamp, but this did not help... – Andrew Aug 19 '15 at 12:59

1 Answers1

3

Found the answer. Apparently vagrant does not support sendfile(), so adding the following to httpd.conf fixed the problem for me.

EnableSendfile off
Andrew
  • 1,179
  • 8
  • 15