Welcome! Log In Create A New Profile

Advanced

Re: Rewrite rule for cache busting URLs

June 09, 2010 04:14PM
On Wed, Jun 09, 2010 at 03:56:36PM -0400, bkirkbri wrote:

> I understand perfectly. Being clever with lots of rewrites and regexs does make the config shorter but we have been bitten in the past by unintended side-effects of all that rewrite chaining (in Apache).

You want to keep making the same mistake. nginx allows to make easily
maintainable configuration. Just forget about rewrites. You should
think how to map URI to file system, but not how to rewrite it.

> I'll go with the verbose config with lots of comments then. :)

If I were you, I would place all "/r\d+" regexs inside literal "/r"
location without any comments:

location /r {

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

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

...

return 404;
}

location /some/resources {
alias /path/to/resources;
}

This allows to minimize maintaince issues.


--
Igor Sysoev
http://sysoev.ru/en/

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

Rewrite rule for cache busting URLs

bkirkbri June 09, 2010 11:21AM

Re: Rewrite rule for cache busting URLs

Igor Sysoev June 09, 2010 11:32AM

Re: Rewrite rule for cache busting URLs

bkirkbri June 09, 2010 12:13PM

Re: Rewrite rule for cache busting URLs

Igor Sysoev June 09, 2010 02:36PM

Re: Rewrite rule for cache busting URLs

bkirkbri June 09, 2010 03:56PM

Re: Rewrite rule for cache busting URLs

Igor Sysoev June 09, 2010 04:14PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 271
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