Welcome! Log In Create A New Profile

Advanced

Re: Conditional http auth

December 03, 2010 04:26PM
On 03/12/2010 23:00, Eugaia wrote:
> Hi,
>
> On 03/12/2010 22:49, Michael Shadle wrote:
>> Got this idea off IRC, but it looks like variables don't expand:
>>
>> set $realm "enter your password";
>>
>> if ($http_via ~* ".somehost.net") {
>> set $realm off;
>> }
>>
>> auth_basic $realm;
>> auth_basic_user_file /etc/nginx/confs/htpasswd.test;
>>
>> Any ideas on how to do conditional auth?
>>
>> auth_basic and such is not allowed under "if" ... trying to figure out
>> some way to dynamically do this.
> I think if you put the if() inside the server rather than inside a
> location it should work.
>
> e.g.
>
> server {
>
> set $realm "enter your password";
>
> if ($http_via ~* ".somehost.net") {
>
> set $realm off;
> }
>
> location / {
> auth_basic $realm;
> auth_basic_user_file /etc/nginx/confs/htpasswd.test;
>
> }
>
It appears that auth_basic doesn't take variables, so this won't work
anyway.

Marcus.

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Conditional http auth

mike December 03, 2010 03:58PM

Re: Conditional http auth

Eugaia December 03, 2010 04:06PM

Re: Conditional http auth

mike December 03, 2010 04:08PM

Re: Conditional http auth

Boris Dolgov December 03, 2010 04:10PM

Re: Conditional http auth

mike December 03, 2010 04:14PM

Re: Conditional http auth

mike December 03, 2010 05:10PM

Re: Conditional http auth

Eugaia December 03, 2010 04:26PM

Re: Conditional http auth

agentzh December 04, 2010 06:24AM

Re: Conditional http auth

agentzh December 04, 2010 06:28AM

Re: Conditional http auth

Eugaia December 04, 2010 10:46AM

Re: Conditional http auth

mike December 04, 2010 06:04PM

Re: Conditional http auth

mike December 06, 2010 07:06AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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