I'm trying to find a way to redirect a user to a different location, if he provides invalid credentials, or no credentials at all.
My configuration looks like this:
server {
listen 9999;
auth_basic "Authentication Required";
auth_basic_user_file passwords;
This causes the user's browser to constantly prompt for credentials, until he cancels the prompt - which returns a 401 error.
I would like to redirect the user to a different page if the authentication failed (for whatever reason) - is this possible with NGINX?