代理使用nginx传递remote_user

时间:2017-07-31 19:00:34

标签: nginx http-headers proxypass

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

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

我不能为我的生活弄清楚如何从防火墙将remote_user标头传递给App。 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;

1 个答案:

答案 0 :(得分:3)

您需要使用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

OLD ANSWER

您正在寻找proxy_pass_header

请参阅:Module ngx_http_proxy_module