I am using nginx as webserver which forwards auth request with credentials or authorization header to another webserver over loopback 127.0.0.1. The recieving webserver is lighttpd which handles authorization requests as OPTIONS method. Hence my nginx auth location looks like below, where lighttpd listens to authorization request on port 8082 in the same machine.
location = /auth {
internal;
proxy_pass_request_body off;
proxy_set_header Content-Length '0';
proxy_pass_header Authorization;
proxy_method OPTIONS;
rewrite ^/auth(.*) *$1 break; # Rewrite /auth to /new-uri
proxy_pass http://127.0.0.1:8082;
}
I find that nginx sends 2 authorization subrequests to lighttpd over 127.0.0.1. Does anyone know why this happens? I found some references in below link which says it happens due to try_files. But I haven’t configured any try_files in nginx conf. Should they be disabled by any option?
https://forum.nginx.org/read.php?2,299344,299348
Solution or suggestion appreciated.