Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 traffic 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

like image 639
Chris Avatar asked Jun 16 '11 02:06

Chris


2 Answers

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??
});
like image 65
imp Avatar answered Sep 30 '22 15:09

imp


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...

like image 30
Chris Avatar answered Sep 30 '22 15:09

Chris