2017-07-31 59 views
1

我有一個防火牆,它是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

回答

2

需要,因爲你的頭包含一個下劃線使用的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