3

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?

BrendanM
  • 383
  • 3
  • 14
  • 2
    Or try [`request-ntlm`](https://github.com/FrankyBoy/request-ntlm) or [`request-simple-ntlm`](https://github.com/msathis/request-simple-ntlm). – robertklep Dec 14 '15 at 10:54
  • Yes just looking at [proxying-agent](https://www.npmjs.com/package/proxying-agent) which seems to support NTLM proxies. Seems a bit of disparity between what its readme says and whats in the source though... – BrendanM Dec 14 '15 at 13:01

1 Answers1

0

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.

Community
  • 1
  • 1
BrendanM
  • 383
  • 3
  • 14
  • Any success doing this? – Jackie Dec 16 '15 at 16:40
  • I have managed to build the messages to send however the server is still coming back with auth fail so some work yet to be done. Its not the highest priority for me at the moment however i will update this when i have it complete. – BrendanM Dec 17 '15 at 11:45