nginx - Nginx auth_request 处理 saml 302 重定向
问题描述
我使用 Nginx 作为反向代理。另外,我正在使用 auth_request 功能来保护我的资源。为此,auth_request 总是通过我使用 SAML 身份验证的授权服务器。在进行身份验证时,有一个重定向 302 到 IDP(在这种情况下为 ssocircle),我试图在 Nginx 上遵循它,但我总是以以下错误结束:
没有定义解析器来解析 idp.ssocircle.com,同时发送到客户端,客户端:127.0.0.1,服务器:,请求:“GET / HTTP/1.1”,子请求:“/saml/login”,主机:“localhost:9000” *1269 身份验证请求意外状态:502 发送到客户端时,客户端:127.0.0.1,服务器:,请求:“GET / HTTP/1.1”,主机:“localhost:9000”
这是我的 Nginx 配置:
server{
listen 9000 ;
auth_request /saml/login;
proxy_intercept_errors on;
error_page 301 302 307 = @handle_redirects ;
location /saml/login {
resolver 46.4.112.4 valid=300s;
internal;
proxy_set_header Host $host;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_pass http://localhost:9090/ ; # url to authorization server
}
location @handle_redirects {
set $saved_redirect_location '$upstream_http_location';
proxy_pass $saved_redirect_location;
}
location / {
root data/www;
}
location /images/ {
root data/ ;
}
}
我尝试添加resolver 46.4.112.4
ssocircle 的 IP,但没有成功。基本上,我想遵循来自我的授权服务器的重定向,并让用户在 IDP 上进行身份验证并返回到原始 URL。我对 Nginx 很陌生。任何帮助都感激不尽。
编辑:我能够解决上述问题。重新启动 Nginx 对我有用。但我再次收到此错误:
身份验证请求意外状态:发送到客户端时出现 302,
解决方案
推荐阅读
- ios - 是否有任何安全的方法可以在运行时删除和重新配置 Firebase 应用程序
- c# - 获取方法输出/引用参数的基本类型
- javascript - 扩展 `Promise` 并更改 `then` 签名
- php - 检查其中一个对象中是否存在密钥
- ruby - 在 Sinatra 中使用标头进行身份验证
- angular - 如何禁用自动键值排序Angular 6
- php - .htaccess 阻止 CSS、javascript 和图像从子目录获取访问权限
- vb.net - 修改 Outlook 按钮的默认行为
- android - 如何在不连接的情况下检查我的 Logcat?
- spring-cloud - 如何使用 DiscoveredResource 遍历 RepositoryRestResource 暴露的单个实体资源