Conditional http auth

Michael Shadle mike503 at
Fri Dec 3 23:49:09 MSK 2010

Got this idea off IRC, but it looks like variables don't expand:

set $realm "enter your password";

if ($http_via ~* "") {
        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.

More information about the nginx mailing list