Welcome! Log In Create A New Profile

Advanced

Dynamically defining auth user file

Posted by mike 
mike
Dynamically defining auth user file
January 19, 2009 08:30AM
i have this snippet

if ($request_uri ~* "/foo/(.+)/") {
set $htpasswd /home/foo/$1/.htpasswd;
}
auth_basic "Restricted files";
auth_basic_user_file $htpasswd;

this shows in the error log:

009/01/18 23:07:49 [crit] 11167#0: *2670248 open()
"/etc/nginx/$htpasswd" failed (2: No such file or directory), client:
1.2.3.4, server: foo.com, request: "GET /9389fd09fsd/ HTTP/1.1", host:
"foo.com"

is there a way to make this work with variables? or is that
impossible? (any other ideas, as well?)
Manlio Perillo
Re: Dynamically defining auth user file
January 20, 2009 12:30AM
mike ha scritto:
> i have this snippet
>
> if ($request_uri ~* "/foo/(.+)/") {
> set $htpasswd /home/foo/$1/.htpasswd;
> }
> auth_basic "Restricted files";
> auth_basic_user_file $htpasswd;
>
> this shows in the error log:
>
> 009/01/18 23:07:49 [crit] 11167#0: *2670248 open()
> "/etc/nginx/$htpasswd" failed (2: No such file or directory), client:
> 1.2.3.4, server: foo.com, request: "GET /9389fd09fsd/ HTTP/1.1", host:
> "foo.com"
>
> is there a way to make this work with variables? or is that
> impossible? (any other ideas, as well?)
>

The auth_basic module does not support variables in the use_file directive.

Should be easy to implement, however.


Regards Manlio Perillo
Sorry, only registered users may post in this forum.

Click here to login