Welcome! Log In Create A New Profile

Advanced

nginx nested location and different basic authentication file

September 27, 2015 04:32AM
Hi ,

I am trying to setup different authentication based on different strings in the $request , here is my case .

location /parent/ {
set $basic_file /nginx/conf/.htpasswd;
if ($request_uri ~ (visualize|dashboard|settings)){
set $basic_file /nginx/conf/.dev_pass;
}
proxy_pass http://<some ip and port >/;
auth_basic "Restricted";
auth_basic_user_file $basic_file;
}

I would like file .htpasswd to be used by default and in case of $request_uri having (visualize|dashboard|settings) , auth should happen via .dev_pass .

For some reason the authentication is happening only via htpasswd even if i have (visualize|dashboard|settings) in the URI .

Any idea , what am i missing?
Subject Author Posted

nginx nested location and different basic authentication file

cacrus September 27, 2015 04:32AM

Re: nginx nested location and different basic authentication file

chris-breda September 27, 2015 11:04AM

Re: nginx nested location and different basic authentication file

Francis Daly September 29, 2015 04:22PM

Re: nginx nested location and different basic authentication file

cacrus September 30, 2015 05:35AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 71
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready