如何使用node.js https的http代理?

我想使用标准的https客户端从node.js进行https请求调用。 但我无法直接从我的networking到达远程服务器,需要通过代理。

如何告诉node.js使用代理? 我试着select这个post

{ path : 'https://api.xxx.com:8081/token'; host : 'proxy-us.xxxx.com'; port : 8082; method : POST_METHOD; headers : { 'host': "api.xxx.com:8081" } 

但从来没有达到

我是Mikeal的请求模块的忠实粉丝。 它使得http请求非常容易,并且具有代理支持,stream,表单,auth和oauth签名等许多function。 这是一个代理的例子:

 var request = require('request'); request({'url':'https://api.xxx.com:8081/token', 'proxy':'http://proxy-us.xxxx.com:8082'}, function (error, response, body) { if (!error && response.statusCode == 200) { console.log(body) // Print the google web page. } })