Hi folks,
I'm trying to set up a simple concept.
I have set up a server listening on a sub-domain. say download.blah.com. set up like this:
[code]
location / {
root /var/www/site/download;
autoindex on;
auth_basic "no!";
auth_basic_user_file /var/www/passwd/.htpasswd;
}
[/code]
every request is being asked for authentication.
I would like to be able to link from another site and those requests would not be authenticated.
logically the setup should look something like this:
[code]
location / {
root /var/www/site/download;
autoindex on;
valid_referers gooddomain.com;
if ($invalid_referer) {
auth_basic "no!";
auth_basic_user_file /var/www/passwd/.htpasswd;
}
}
[/code]
But Nginx does not accept auth_basic commands in "if"
so I can try and reverse it. but I can't use ! or =0 on the $invalid_referer inside the if condition.
so this, doesn't work either
[code]
location / {
root /var/www/site/download;
autoindex on;
valid_referers gooddomain.com;
if (!$invalid_referer) {
break;
}
auth_basic "no!";
auth_basic_user_file /var/www/passwd/.htpasswd;
}
[/code]
I'm using Nginx 8.20 (on linux as the paths might indicate)
Any ideas?
10x,
Uri