Nginx reverse proxy - passthrough basic authenication
13,445
I think nginx is blocking request headers and not sending them to IIS. Try setting
proxy_pass_request_headers on;
on your location block.
Greetings.
Related videos on Youtube
Comments
-
Ryan over 1 year
I am trying to setup nginx as a reverse rpoxy server in front off several IIS web servers who are authenticating using Basic authentication.
(note - this is not the same as nginx providing the auth using a password file - it should just be marshelling everythnig between the browser/server)
Its working kind off - but getting repeatedly prompted for auth by every single resource (image/css etc) on a page.
upstream my_iis_server { server 192.168.1.10; } server { listen 1.1.1.1:80; server_name www.example.com; ## send request back to my iis server ## location / { proxy_pass http://my_iis_server; proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; proxy_http_version 1.1; proxy_pass_header Authorization; proxy_redirect off; proxy_buffering off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }
-
Ryan over 11 yearsThats for use when ningx is doing the auth itself (not for passthrough to upstream server) which I am not doing as explained in the question.