Proxy pass remote_user with nginx

10,244

You need to use a combination of proxy_pass_request_headers on and underscores_in_headers on since your header contains an underscore.

underscores_in_headers needs to be placed in your http block.

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

OLD ANSWER

You are looking for proxy_pass_header

See: Module ngx_http_proxy_module

Share:
10,244
Thomas
Author by

Thomas

Powered by C++11, Typescript, Scala

Updated on June 21, 2022

Comments

  • Thomas
    Thomas almost 2 years

    I have a firewall that is the SSL terminator and sets the remote_user header. This header should be passed onto an application, however we have an nginx proxy sitting in the middle.

    Browser over SSL -> Firewall proxy -> Nginx proxy -> App

    I cannot for the life of me figure out how to pass the remote_user header to the App from the Firewall. Nginx seems to swallow it. $remote_user doesn't have it (which makes sense). $http_remote_user doesn't have it (which doesn't make sense). I tried to find it in $proxy_add_* but couldn't.

    How do I proxy pass the remote_user header when the SSL terminator isn't nginx?

    EDIT1: Other things I have tried:

    proxy_pass_request_headers on;
    proxy_pass_header remote_user;
    proxy_set_header other_user $http_remote_user;
    
    proxy_pass http://scooterlabs.com/echo;