location into location doen't work as expected
Igor Sysoev
is at rambler-co.ru
Tue Apr 7 19:09:51 MSD 2009
On Tue, Apr 07, 2009 at 05:04:40PM +0200, Daniele Melosi wrote:
> Hi all,
>
> I've the following location configuration that doesn't work as expected
> (i symplified my configuration with return value instead of rewrite):
>
> location ^~ /image/ {
> location ^~ /image/(halfcol|medium|thumb)/ {
> return 402;
> }
> location ^~ /image/ {
> return 403;
> }
> }
>
> if i tried to get a /image/halfcol/something i expected to received a
> 402 return code.
>
> $ HEAD http://localhost/image/halfcol/pippo.jpg | head -n1
> 403 Forbidden
>
> I got a 403 instead :(
The "^~" is not regex, conversely it disables to run regex, therefore:
location /image/ {
return 403;
}
location ~ ^/image/(halfcol|medium|thumb)/ {
return 402;
}
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list