Welcome! Log In Create A New Profile

Advanced

Turn basic authentication on and off for specific HTTP user agent

November 26, 2012 03:24AM
Hello All!

Is it possible to turn authentication on and off for a specific user agent in some location? When I configure the following

location /specloc/ {
if ($http_user_agent ~ MSIE) {
auth_basic "private area";
auth_basic_user_file /etc/nginx/htpasswd;
}
#...
}

my "nginx -t" prints

nginx: [emerg] "auth_basic" directive is not allowed here in /etc/nginx/nginx.conf:75
nginx: configuration file /etc/nginx/nginx.conf test failed

Thank you if you answer.
Subject Author Posted

Turn basic authentication on and off for specific HTTP user agent

hide November 26, 2012 03:24AM

Re: Turn basic authentication on and off for specific HTTP user agent

Ruslan Ermilov December 10, 2012 08:34AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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