开发者

Trying to capture node.js http traffic with a protocol analyser (Charles) but can't get node to use proxy

i'm trying to capture node.js http tra开发者_开发技巧ffic with a protocol analyser (Charles) but can't get node to use the proxy. Is there some way to get nodes http and https modules to use a proxy?

I'm using OSX by the way


Thanks Chris in my case I was using Charles and Request module. There is a handle proxy option to put your charles port.

So to find your port in the Charles menu Proxy->Proxy Settings->Http Proxy

Use this port number in any request eg:

request.get(url, {
  'proxy': 'http://localhost:<charles-proxy-port>'
}, function (error, response, body) {
   //did you see me in Charles??
});


Figured it out. I was following the instructions from How can I use an http proxy with node.js http.Client? And i thought i needed to use https to access the proxy. But if i use http to access the proxy, and pass eg 'path: 'https://www.google.com/accounts/OAuthGetRequestToken', then it works...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜