Welcome! Log In Create A New Profile

Advanced

auth_basic within location block doesn't work when return is specified?

Scott McGillivray
November 06, 2016 10:12AM
i thought this would work but for some reason it doesn't.

location /auth {
auth_basic_user_file /etc/nginx/.htpasswd;
auth_basic "Secret";

return 200 'hello';
}



When i specify the return, 200 or 301, it just skips the auth_basic and processes the return statement.

If i comment out the return statement it works OK. Ideally i want just an /auth endpoint that once authenticated it will 301 redirect to $host, e.g. return 301 http://$host

Can someone explain why this behaves this way and what is the correct configuration.

many thanks
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

auth_basic within location block doesn't work when return is specified?

Scott McGillivray November 06, 2016 10:12AM

Re: auth_basic within location block doesn't work when return is specified?

Igor A. Ippolitov November 07, 2016 03:40AM

Re: auth_basic within location block doesn't work when return is specified?

Igor A. Ippolitov November 07, 2016 06:16AM

most efficient way to return on everything but a single directory?

Jonathan Vanasco November 07, 2016 08:16PM

Re: most efficient way to return on everything but a single directory?

Igor Sysoev November 07, 2016 11:36PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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