[英]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. 我试图用协议分析器(Charles)捕获node.js http流量但是无法让节点使用代理。 Is there some way to get nodes http and https modules to use a proxy?
有没有办法让节点http和https模块使用代理?
I'm using OSX by the way 我顺便使用OSX
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 所以要在Charles菜单中找到你的端口代理 - >代理设置 - > Http代理
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?
我遵循了如何使用带有node.js http.Client的http代理的说明? And i thought i needed to use https to access the proxy.
我认为我需要使用https来访问代理。 But if i use http to access the proxy, and pass eg 'path: ' https://www.google.com/accounts/OAuthGetRequestToken ', then it works...
但是,如果我使用http访问代理,并通过例如'path:' https : //www.google.com/accounts/OAuthGetRequestToken ',那么它的工作原理......
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.