I'd like to set up an Apache vhost such that browsers will cache images locally but will check back against the server for updates each time prior to displaying images.
I have this currently:
<VirtualHost *:80>
ServerName cdn.localhost
DocumentRoot /Users/chad/development/support/cdn
FileETag None
<Directory /Users/chad/development/support/cdn>
AllowOverride None
Order Deny,Allow
</Directory>
</VirtualHost>
and, at least locally, files are cached indefinitely in browsers until I manually clear the browsers' cache. I don't like this. When I update a new image to replace an old image, browsers do not see this update.
I know I can turn caching off like this
FileETag None
<Directory /Users/chad/development/support/cdn>
AllowOverride None
Order Deny,Allow
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Headers "Content-Type"
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate, proxy-revalidate, no-transform"
Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
</Directory>
but I don't want it completely off.
So, how can I instruct browsers to cache images but still check against the server for updates?
0 Answers