nginx 代理传递和 auth_basic 在每个请求上提示登录

nginx 代理传递和 auth_basic 在每个请求上提示登录

我设置了一个简单的反向代理,将其移动/到本地主机守护程序以进行测试。基本上,它是根目录下的代理,并且身份验证正在运行。问题是它在每个请求上都提示登录。目前它是这样的:

 server {

        listen 80;
        server_name  whatever.com.net;
        access_log /var/log/prototype/access.log;
        error_log /var/log/prototype/error.log;

        auth_basic "Prototype Login";
        auth_basic_user_file /etc/nginx/.htpasswd;

        location / {
                proxy_pass http://127.0.0.1:9000;

                #auth_basic "Prototype Login";
                #auth_basic_user_file /etc/nginx/.htpasswd;
        }
}

我非常确定我明白为什么会发生这种情况,但我不确定是否有解决方案,因为它目前已设置好。localhost 应用程序根本不关心此身份验证,因此不存在下游标头问题,这完全是 nginx 在每个请求上提示登录。有没有办法更好地处理这种类型的代理传递,以便仅通过 nginx 进行初始身份验证?

相关内容