Created by: Alankarsharma
Earlier example was working well when the requests were hitting the proxy in sequential manner. But in case of multiple parallel authentication requests it fails intermittently. Default “getName” function of NodeJS Agent class considers the hostname and port number of backend server to decide whether to reuse an existing connection or create a new connection. As all the request go to one server only one single connection (In case of load connection never expires) is created for all the requests from proxy to server. This causes an issue in NTLM authentication, as NTLM is a challenge/response authentication, one client may be sending its first request ( to which server will respond with challenge) and at same time other might send response to the challenge, as single connection is used to send all the data to server, server rejects both the request and client gets unauthorised response. Considering from which client the request is coming and creating a different connection based on the client solves this problem.