Conditional http auth
ngx.eugaia at gmail.com
Sat Dec 4 18:41:48 MSK 2010
On 04/12/2010 13:18, agentzh wrote:
> With the ngx_lua  module enabled, it's trivial:
> set_by_lua $realm '
> if string.match(ngx.var.http_via, ".somehost.net") then
> return "off"
> return "enter your password"
> auth_basic $realm;
> auth_basic_user_file /etc/nginx/confs/htpasswd.test;
> This should have great performance even if you're using Lua ;)
I've not tested it, but I had a quick look at the code and it appears
that auth_basic doesn't accept variables (yet), so regardless of the
setting mechanism, I don't think it will work.
Adding variable support to auth_basic, though, could be useful it seems.
More information about the nginx