Im trying to configure nginx to do user authentication before accessing a resource. Currently my configuration is as follows:
server {
listen 80 default_server;
listen [::]:80 default_server;
location = /test {
satisfy any;
auth_basic "test";
auth_basic_user_file "/usr/local/nginx/htpasswd";
auth_request /auth;
proxy_pass http://localhost:9000/;
}
location = /auth {
proxy_pass http://192.168.111.101:8080/auth;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
}
}
So what i want to happen is that nginx should ask the user for password using the "auth_basic" procedure. (this will fail, since the user is not in the auth_basic_user_file )
then nginx should try the "auth_request" and also provide the username/password used in the "auth_basic". Same solution as here: https://stackoverflow.com/questions/23299623/nginx-authentication-with-auth-request-module however it seem like nginx is somehow preferring the "authrequest" so this is done first, and the "auth_basic" is executed afterwards.
Any ideas on what im doing wrong?
0 Answers