Cache busting with nginx
Here's a little snippet for cache busting without abusing a query string which can lead to caching problems.
The example below will rewrite paths like /css/foo_20130401-5.css to /path/to/static/css/foo.css on the static.example.com host.
server {
server_name static.example.com;
root /path/to/static/;
location ~* ^/(\w+)/(\w+)_[\d-]+\.(css|js) {
alias /path/to/static/$1/$2.$3;
expires max;
}
}
0 comments
Reply