Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to capture http messages from Request Node library with Fiddler

Tags:

Regular client initiated requests to the node server are captured fine in Fiddler. However, requests sent from node to a web service are not captured. It did not help to pass in config for proxy (127.0.0.1:8888) to the request method. How can I route the request messages through Fiddler?

var http = require('http'); var request = require('request');  request.get(webserviceURL, { "auth" : {"user": "user", "pass" = "pass", sendImmediately: true }, "proxy" : { "host" : "127.0.0.1", "port" : 8888 }}, function (error, response) { console.log( "response received" ); }); 

Request repo: https://github.com/mikeal/request

like image 481
mupersan82 Avatar asked Jun 29 '13 18:06

mupersan82


People also ask

How do you capture traffic in Fiddler everywhere?

Click Open Browser from the Live Traffic toolbar. Enter the URL in the newly opened Chrome window. Fiddler Everywhere immediately starts capturing all the traffic generated from the preconfigured browser.


2 Answers

I just tried to do this myself (using Fiddler and the request library from npm). Here's how I got it working:

process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0'; // Ignore 'UNABLE_TO_VERIFY_LEAF_SIGNATURE' authorization error  // Issue the request request( {     method: "GET",     uri: "https://secure.somewebsite.com/",     proxy: "http://127.0.0.1:8888" // Note the fully-qualified path to Fiddler proxy. No "https" is required, even for https connections to outside. }, function(err, response, body) {     console.log("done"); }); 

This is with Fiddler2 using the default port and proxy options (and no proxy authentication).

like image 200
idolize Avatar answered Oct 21 '22 13:10

idolize


Fiddler works by setting your "Internet Options" (from start menu) "Connections" > "LAN Settings" > "Proxy Server" to its port, thus making all HTTP traffic (clients which obey this setting) go through it.

You should point your node.js client lib to use a proxy, the settings are written in that options dialog after you start Fiddler.

like image 29
Poni Avatar answered Oct 21 '22 13:10

Poni