auth_basic from if condition?
Igor Sysoev
is at rambler-co.ru
Mon Nov 19 21:45:45 MSK 2007
On Mon, Nov 19, 2007 at 06:23:40PM +0000, Sergey wrote:
> I seem to have discovered that something that I thought was possible might
> actually not be so.
>
> I have a scenario where I would like users from specific IP ranges to have to go
> through the authentication procedure and others not to.
>
> I thought for sure this would work:
> if ( $remote_addr != range ) {
> auth_basic "bla";
> auth_basic_user_file users.conf;
> }
>
> However, I'm discovering that if you do a test of this config that nginx does
> not like the auth_basic directive in the if condition. Is this the correct
> behaviour?
Yes.
> Is there a way around it? Is there some way to emulate what I want?
location / {
satisfy_any on;
allow 192.168.1.0/32;
deny all;
auth_basic "bla";
auth_basic_user_file users.conf;
}
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list