Closed gotardo closed 12 years ago
This is actually wrong as the goal of far-future expires is to make it stay in cache forever regardless of real expiration - in case you need to expire it, you should change the URL instead - that's why we have mod_rewrite rules to allow for name.ver.ext file names where "ver" is a virtual version that is actually just used for cache busting when you need that.
You can read the rationale behind this in my article in Performance Calendar 2010: http://calendar.perfplanet.com/2010/easy-cache-headers/
Thanks, Sergei. I actually needed to use modification for a project in which some files my change without changing the name. So I think I will keep both ways of caching depending on the project. Kind regards.
Well, this will not help anyway because you are setting expiration one year ahead, but can't predict when they will really expire.
For cases where you absolutely have to keep file names, you can use shorter expiration or use far future expiration and update technique discovered by Stoyan Stefanov and Steve Souders: http://www.stevesouders.com/blog/2012/05/22/self-updating-scripts/
Hi Sergey, That's a really interesting article. In my case, I think it won't work because the use of an iframe and a second script just to check the availability of a new version will be too slow for a web that needs just a couple of scripts (large images are my real problem). Thanks a lot!
Well, in this case, you should concentrate on changing the URLs - I built SVN assets, but you can also use simple fingerprinting as well - it allows for not adding too much of the process.
Hello, I added a litlle change to the cache expiration config to set it on "modification plus 1 year". Regards!