【问题标题】:Proxy pass remote_user with nginx代理通过 nginx 传递 remote_user
【发布时间】:2018-01-07 11:17:50
【问题描述】:

我有一个防火墙,它是 SSL 终结器并设置了 remote_user 标头。这个标头应该传递给应用程序,但是我们在中间有一个 nginx 代理。

SSL 上的浏览​​器 -> 防火墙代理 -> Nginx 代理 -> 应用程序

我一生都无法弄清楚如何将 remote_user 标头从防火墙传递给应用程序。 Nginx 似乎吞下了它。 $remote_user 没有它(这是有道理的)。 $http_remote_user 没有它(这没有意义)。我试图在 $proxy_add_* 中找到它,但找不到。

当 SSL 终止符不是 nginx 时,如何代理传递 remote_user 标头?

EDIT1:我尝试过的其他事情:

proxy_pass_request_headers on;
proxy_pass_header remote_user;
proxy_set_header other_user $http_remote_user;

proxy_pass http://scooterlabs.com/echo;

【问题讨论】:

  • proxy_set_header remote_user bob;不过效果很好……对于鲍勃。
  • 您确定您的防火墙代理已成功设置remote_user 标头吗? nginx甚至收到了吗?
  • 已设置,下划线_in_headers on;正如下面所说的 gargsms 是缺少的链接。
  • @Thomas 您能否更新答案以包含 gargsms 建议的标题并提及它已更新。
  • @Nitb 它已经在答案中并且已经表明它已更新......

标签: nginx http-headers proxypass


【解决方案1】:

您需要使用proxy_pass_request_headers onunderscores_in_headers on 的组合,因为您的标题包含下划线。

underscores_in_headers 需要放在您的 http 块中。

见:http://nginx.org/en/docs/http/ngx_http_core_module.html#underscores_in_headers

老答案

您正在寻找proxy_pass_header

见:Module ngx_http_proxy_module

【讨论】:

  • 无效(后文示例)
  • 我可以拥抱你。
猜你喜欢
  • 1970-01-01
  • 2023-03-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-05-09
  • 2018-05-06
  • 2014-12-05
  • 1970-01-01
相关资源
最近更新 更多