Location into location doen't work as expected

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 :frowning:

Thanks in advance
Daniele

On Tue, Apr 07, 2009 at 05:04:40PM +0200, Daniele M. wrote:

 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 :frowning:

The “^~” is not regex, conversely it disables to run regex, therefore:

location /image/ {
return 403;
}

location ~ ^/image/(halfcol|medium|thumb)/ {
return 402;
}