Can a proxy (like fiddler) be used with Node.js's ClientRequest

前端 未结 6 763
栀梦
栀梦 2020-12-23 02:13

Can node.js be setup to recognize a proxy (like Fiddler for example) and route all ClientRequest\'s through the proxy?

I am using node on Windows and would like to d

6条回答
  •  滥情空心
    2020-12-23 02:28

    If you want to montior outgoing reqeusts from node you can use the request module

    and just set the proxy property in the options, like that

    request.post('http://204.145.74.56:3003/test', {
    headers :{ 'content-type' : 'application/octet-stream'}, 
    'body' : buf ,
     proxy: 'http://127.0.0.1:8888'
    }, function() {
       //callback
    });
    

    8888 is the default port , of fiddler .

提交回复
热议问题