Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to intercept HTTP requests and responses of a client machine (like fiddler does)

I thought that the only way to intercept a request is to use a proxy, but fiddler somehow can intercept HTTP requests and responses without configuring anything on any browsers.

What's going on under the hood ?

And do you know any library to do that ? (In any languages)

like image 742
Nicolas Dorier Avatar asked Jun 17 '09 17:06

Nicolas Dorier


People also ask

How do you intercept HTTP requests and responses?

To intercept HTTP requests, use the webRequest API. This API enables you to add listeners for various stages of making an HTTP request. In the listeners, you can: Get access to request headers and bodies and response headers.

Which tool can be used to capture and forward HTTP requests?

The Postman app has a built-in proxy that can capture HTTP and HTTPS traffic. Here's how it works: The Postman app listens for any calls made by a client app or device using the proxy. The Postman proxy captures the request and forwards it to the server.

How do I trace HTTP requests?

Right-click on a request, and the option should show up in the contextual menu. Send the resulting trace log file to support.

How do I use Fiddler to capture API calls?

Launch Fiddler exe and it will start capturing HTTP traffic (For HTTPS URL see next section). Run fiddler to start capturing web requests/responses made by various client applications on your system (e.g. Curl, Chrome, Internet Explorer). To start/stop capture go to File > Check/Uncheck [Capture Traffic] option.


2 Answers

Fiddler is a proxy, written in C# and wrapping basic sockets.

It registers with WinINET using the appropriate API call while running, and detaches in the same way. Most browsers automatically detect the WinINET proxy setting and use it. Firefox does not, which is why current versions of Fiddler install a Firefox addon.

-EricLaw [MSFT]

like image 132
EricLaw Avatar answered Sep 28 '22 00:09

EricLaw


Fiddler actually does use a proxy. I believe the installer automatically configures IE to use Fiddler's proxy. You can also configure other browsers to go through the same proxy, so Fiddler will profile their network traffic too.

More info here

like image 43
KOTJMF Avatar answered Sep 27 '22 22:09

KOTJMF