How to catch a request that has a given word in url?

Igor Sysoev igor at sysoev.ru
Mon Aug 9 14:04:00 MSD 2010


On Mon, Aug 09, 2010 at 11:59:02AM +0200, Fernando Perez wrote:

> I'll use actual values:
> 
> A public request looks like:
> 
> /uploads/2009/product.jpg
> 
> 
> An a restricted request looks like:
> 
> /uploads/2009/restricted/product.mp4
> 
> 
> So I have:
> 
> location ~ /restricted/ {
>   internal;
>   root ...;
> }
> 
> location ^~ /uploads/ {
>   root ...;
> }
> 
> 
> Is it my /uploads/ location which fits maybe better the request and 
> confuses nginx?

"^~" disables regex locaitons testing, so you need something liek this:

 location ~ /restricted/ {
   internal;
   root ...;
 }
 
 location /uploads/ {
   root ...;
 }


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



More information about the nginx mailing list