使用 nginx 代理传递 remote_user

Tho*_*mas 5 nginx proxypass http-headers

我有一个防火墙,它是 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;
Run Code Online (Sandbox Code Playgroud)

gar*_*sms 6

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

underscores_in_headers需要放置在您的 http 块中。

请参阅: http: //nginx.org/en/docs/http/ngx_http_core_module.html#underscores_in_headers

旧答案

您正在寻找proxy_pass_header

请参阅:模块 ngx_http_proxy_module

  • 我可以拥抱你。 (4认同)