Nginx - Forward HTTP AUTH - User

Solution 1:

Try adding this directives to your location block

proxy_set_header Authorization $http_authorization;
proxy_pass_header  Authorization;

Solution 2:

To get this to work with Jenkins reverse proxy auth plugin:

proxy_set_header Authorization "";
proxy_set_header X-Forwarded-User $remote_user;

If you don't reset Authorization header, nginx will forward that by default, and when enabling reverse proxy auth plugin, Jenkins (jetty) will try to re-authenticate the user, and fails on that.

nginx version 1.12.1, Jenkins 2.113.