Welcome! Log In Create A New Profile

Advanced

Re: location into location doen't work as expected

April 07, 2009 11:09AM
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/
Subject Author Posted

location into location doen't work as expected

Daniele Melosi April 07, 2009 11:04AM

Re: location into location doen't work as expected

Igor Sysoev April 07, 2009 11:09AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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