使用 NTLM 的 Windows 身份验证的 nginx 反向代理

标签 nginx reverse-proxy ntlm

任何人都知道是否可以使用使用 NTLM 的 Windows 身份验证进行反向代理?我找不到任何关于此的示例。 more_set_headers 字段的值应该是多少?

location / {
            proxy_http_version      1.1;
            proxy_pass_request_headers on;
            proxy_set_header        Host            $host;
            proxy_set_header        X-Real-IP       $remote_addr;
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;


            more_set_input_headers  'Authorization: $http_authorization';

            proxy_set_header  Accept-Encoding  "";

            proxy_pass              http://host/;
            proxy_redirect          default;
            #This is what worked for me, but you need the headers-more mod
            more_set_headers        -s 401 'WWW-Authenticate: Basic realm="host.local"';
}

如果我直接访问主机,则身份验证成功,如果我使用反向代理访问,身份验证每次都会失败。

最佳答案

使用 Nginx 启用 NTLM 直通 -

upstream http_backend {
    server 2.3.4.5:80;
    keepalive 16;
}
server {
    ...
    location / {
       proxy_pass http://http_backend/;
       proxy_http_version 1.1;
       proxy_set_header Connection "";
    ...
    }
 }

——拉蒙

关于使用 NTLM 的 Windows 身份验证的 nginx 反向代理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21284935/

相关文章:

django - 如何提供存储在 cassandra 数据库中的图像?

azure - 使用 Service Fabric 和反向代理时,ASP.NET Core 静态文件的加载时间缓慢

nginx - nginx 中 IF 语句的语法

nginx - 在Kubernetes NGINX反向代理入口 Controller 中按路径重写

python - urllib2.HTTPError : HTTP Error 401: Unauthorized

linux - cURL 始终使用 NTLM 返回 401

javascript - Nginx 和 CORS 问题

django - 在 Nginx 代理 + apache 设置中重写 URL

wordpress - 如何将 Nginx 配置为仅为 Azure 应用服务上的 WordPress 提供 https 服务

android - WebView 中的 NTLM 身份验证