[Solved] Is it possible to invalidate mod_expire to force reload?
Added by l3u over 2 years ago
Hi all :-)
I use mod_expire
to make people cache static stuff like images etc., with the following setting:
$HTTP["url"] =~ "^/static/" { expire.url = ( "" => "access plus 1 months" ) }
This works fine, but the problem is that if I mess with CSS or such, the new version of the style sheet will possibly not be loaded automatically and the page will look messy. One can bypass this by force-reloading (e.g. via CTRL+F5
), but some people may not know this.
Is there a way to tell a browser that it should reload the static stuff? Something I could automate, e.g. when I change something inside /static
, this cache invalidation would happen, and everybody would re-fetch all static stuff?
Thanks for all help!
Replies (2)
RE: Is it possible to invalidate mod_expire to force reload? - Added by gstrauss over 2 years ago
Is there a way to tell a browser that it should reload the static stuff?
No, not for that specific resource if you already told caching proxies and browsers that they could cache that resource for 1 month.
Something I could automate, e.g. when I change something inside /static, this cache invalidation would happen, and everybody would re-fetch all static stuff?
No, not inside /static
An alternative solution is to have the .html caching for, say 1 hour, or 1/2 day. When you want to change the .css, you change the name of the .css file and update the .html file. The original .css is cacheable for 1 month and the new .css (with a different name) is cacheable for 1 month.
RE: [Solved] Is it possible to invalidate mod_expire to force reload? - Added by l3u over 2 years ago
Too bad. Thanks for the clarification anyway :-)