允許 IP 位址繞過 Nginx auth_request 模組中的身份驗證

允許 IP 位址繞過 Nginx auth_request 模組中的身份驗證

我有如下的配置。我想允許 IP 清單繞過身份驗證。

server {
 listen 80;

 server_name test2.example.com;
 add_header Strict-Transport-Security max-age=2592000;

  location = /oauth2/auth {
      internal;
      proxy_pass http://oauth.example.com:4180;
  }

  location /oauth2/ {
      proxy_pass http://oauth.example.com:4180;
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Scheme $scheme;
  }

  location / {
    auth_request /oauth2/auth;
    error_page 401 = /oauth2/start?rd=$request_uri;
    proxy_pass https://test.example.com;
  }
}

我已嘗試在上面添加此內容auth_request,但這似乎沒有幫助。我可以在日誌中看到該請求來自白名單 IP。

satisfy all;
allow 10.0.0.0/16;
allow 56.56.56.56/28;
deny all;

更新:修改satisfy allsatisfy any修復 IP 位址繞過問題。

相關內容