Welcome! Log In Create A New Profile

Advanced

Re: Best way to burst static file cache

Ed W
October 02, 2011 09:16AM
On 02/10/2011 13:34, tcbarrett wrote:
> kaspars Wrote:
> -------------------------------------------------------
>> Well, if you set cache to expire 30 years from now
>> the browser should honor that, that is if no
>> Last-Modified is set.
> I have it set to 30m (30 minutes, right?). If I update, for example,
> some css files and then a do a hard refresh on a) a Mac then I get the
> new css or b) Windows 7 then I keep getting the cached css files.
>
> Is there any technique to burst this caching. It might not be a 'pure
> nginx' solution, but anything that could be supported by an nginx config
> setting?
>

What everyone else does is set the URLs to be unique and then change the
url when the asset is updated. eg a simple example which rails uses and
arguably isn't perfect would be:

/assets/blah.jpg?12333234

The random string after the ? could be generated in various ways, eg
incrementing counter or it could be the epoch time of the file mtime (ie
age in seconds)

Now you can set expire time to 30 years and when the asset is updated
you simply arrange for the url to be updated in the html and a "new"
image is pulled down

Implementation left to the reader as an exercise...

Ed W

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Best way to burst static file cache

tcbarrett September 26, 2011 06:11AM

Re: Best way to burst static file cache

tcbarrett September 29, 2011 11:06AM

Re: Best way to burst static file cache

kaspars September 29, 2011 07:09PM

Re: Best way to burst static file cache

tcbarrett October 02, 2011 08:34AM

Re: Best way to burst static file cache

Ed W October 02, 2011 09:16AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 318
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready