Rewrite rule for cache busting URLs

bkirkbri nginx-forum at
Wed Jun 9 20:13:22 MSD 2010

Thanks Igor!

I should have been more specific though.  Sometimes the same resource is referenced in a versioned _and_ non-versioned form.  Also, the versioning applies to many resource locations.

So we would need many config entry pairs like this:

location ~ ^/r\d+(/some/resources/.+)$ {
    alias /path/to/resources/$1;
    add_header Cache-Control 'public, max-age=2592000'; # 30 days

location ^~ /some/resources {
    alias /path/to/resources;


We can do that, but it makes the config harder to maintain.

Another related question: if we configure FastCGI access to our application in a separate file and include that same config file in many location {} blocks with "include" will that cause any problems?

Thanks again!

Posted at Nginx Forum:,96334,96358#msg-96358

More information about the nginx mailing list