javascriptnode.jsnode-webkitnode-requestproxy-authentication

Proxy Authentication and node request


I am trying to send a get request to a site over https using request. I am however, behind a proxy, which requires authentication to use. When i try to add the authentication however it fails to connect to the site.

I have tried adding the authentication in the proxy url like:

var proxyUrl = "http://" + 'user' + ":" + 'password' + "@" + 'url:8080';
var request = require('request').defaults({proxy: proxyUrl});

I also tried to add the authorization to the header however this had also the same problem

headers: {
            'Proxy-Authorization': new Buffer('user:password').toString('base64')
}

It seems the proxy is coming back with the auth response however request dosent seem to send anything after that so it does not actually login. Is there some more config i need to add?


Solution

  • Turned out the Proxy we are using is using NTLM authentication. So in order to authenticate I must use the NTLM protocol instead of Basic. I will look into using Proxing-agent to do this authentication. Or as mentioned by robertklep there are some options for directly authenticating with the server using NTLM.

    Managed to implement this using NTLM.js from the node-proxying-agent and request using the following description of the protocol.