使用nginx代理传递remote_user

问题描述:

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

浏览器通过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; 
+0

proxy_set_header REMOTE_USER鲍勃;工作很棒虽然...为鲍勃。 – Thomas

+0

您确定您的防火墙代理已成功设置'remote_user'标头吗? nginx是否会收到它? – sharif9876

+0

设置了underscores_in_headers;因为下面陈述的谣言是缺失的环节。 – Thomas

需要,因为你的头包含一个下划线使用的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

+0

没有影响(在帖子中的例子) – Thomas

+0

@Thomas我已经更新了上面的答案。 – gargsms

+0

我可以拥抱你。 – Thomas