chuckj chuckj - 1 year ago 142
Javascript Question

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

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 debug the http requests much like I would using Fiddler for JavaScript in the browser.

Just be clear, I am not trying to create a proxy nor proxy requests received by a server. I want to route requests made by

through a proxy. I would like to use Fiddler to inspect both the request and the response as I would if I was performing the request in a browser.

Answer Source

To route your client-requests via fiddler, alter your options-object like this (ex.: just before you create the http.request):

options.path = 'http://' + + ':' + options.port + options.path; =; = '';
options.port = 8888;

myReq = http.request(options, function (result) {