Nginx身份验证模块的退货顺序

我有这样的nginx配置。

server {
    ...

    auth_basic 'closed';
    auth_basic_user_file /etc/nginx/htpassw;

    location = /authentication {
        proxy_method POST;
        proxy_pass http://auth-proxy/api/v1/token-verify/;
        proxy_pass_request_body off;
        proxy_set_header Content-Length "";
        proxy_set_header X-Original-URI $request_uri;
        proxy_set_header X-Original-METHOD $request_method;
    }

    location /location/ {
        satisfy any;
        auth_request /authentication;
        proxy_pass http://location-proxy/;
    }

}

问题是auth-proxy可以返回401或403状态。 但是由于基本身份验证失败,nginx似乎忽略了403状态。

有什么方法可以设置nginx conf吗?

try basic auth;
if failed
  try auth_request and return status code from it;
owihs 回答:Nginx身份验证模块的退货顺序

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3159112.html

大家都在问