无法绕过Nginx中特定网址的基本身份验证

时间:2019-01-24 21:09:55

标签: amazon-web-services nginx amazon-elb nginx-location

我已经阅读并尝试了类似帖子中提到的几乎所有步骤/选项。 这是我的Nginx文件的样子:

location / {
        proxy_pass    http://localhost:8000;
        auth_basic "Restricted Content";
        auth_basic_user_file /etc/nginx/.htpasswd;
    }

我正在尝试从基本身份验证中排除以下部分:

  

/ engine / v1 /状态

到目前为止,我已经尝试了以下方法:

location **/engine/v1/status** {
            **auth_basic "off"**;
            allow all; # Allow all to see content 

}

location **= /engine/v1/status** {
            **auth_basic off;**
            allow all; # Allow all to see content 

}

location **= /engine/v1/status** {
            **auth_basic "off";**
            allow all; # Allow all to see content 

}

我仍然得到

  

HTTP 401:未经授权您配置了侦听器规则以进行身份​​验证   用户。您将OnUnauthenticatedRequest配置为拒绝   未经身份验证的用户或IdP拒绝访问

在我的AWS目标组中

我在这里做什么错了?

1 个答案:

答案 0 :(得分:0)

这就是我做到的方式。

Issue