24 hours cache expiry on static resources?


#1

It seems images and other static resources are sent with max-age=86400 in the cache-control header – but shouldn’t files such as images have a much longer expiry date than 24 hours?


#2

I believe the reason for this is because there is no way to cause the browser to reload these if they do change. The rest of the application is compiled and have different hashes applied to the file names when something is changed. This is not the case with static assets in the private folder. In the Meteor source code note is made of this and the fact it should be changed.


#3

But I could just append a version number in the query string of a file’s
url, if I wanted to refresh the cache, as per usual?


#4

Yes, but not everyone who uses Meteor does that. Also the most reliable cache busting method is renaming the file (see http://stackoverflow.com/a/20746756/759971 why the query string method can fail).

If you want to increase this, you can use a CDN or webserver like Nginx to deliver the static assets.


#5

Fair point with nginx, but I still think it would be valid to increase the
expiry when the --production flag is set.