我对Nginx和Jenkins(Hudson)感到有些麻烦。我正在尝试使用Nginx作为具有HTTP基本身份验证的Jenkins实例的反向代理。
到目前为止,它仍然有效,但是我不知道如何通过身份验证用户名传递标头?
location / {
auth_basic "Restricted";
auth_basic_user_file /usr/share/nginx/.htpasswd;
sendfile off;
proxy_pass http://192.168.178.102:8080;
proxy_redirect default;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-User $http_authorization;
proxy_max_temp_file_size 0;
#this is the maximum upload size
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
1
请注意,您可能需要在“ X-Forwared-User”中添加一个额外的“ d”。
—
Paul