Skip to content

Debugging with Fiddler

bchavez edited this page Nov 28, 2019 · 8 revisions

Introduction

Fiddler is a proxy program that helps debug HTTP and HTTPS traffic by setting up a local proxy and passing all web traffic through the local Fiddler proxy. When web traffic flows through the a local Fiddler proxy, HTTP and HTTPS traffic is available for inspection.

Fiddler Concept

The following instructions demonstrate how to set up a local Fiddler Proxy to debug a .NET Application using HTTP or HTTPS.

Setup and Configuration

1. Install

2. Enable Decryption of HTTPS Traffic

The following configures Fiddler to decrypt HTTPS traffic by installing and trusting a self-signed trusted "root certificate" in the local computer's "root certificate" store.

  • Go to Tools > Fiddler Options.... Click on HTTPS tab.
    • Enable Capture HTTPS CONNECTs.
    • Enable Decrypt HTTPS traffic ...from all processes.
    • Follow all prompts to install the Root Certificate.
    • Click Ok to save settings.

Fiddler Options - Tools HTTPS Tab

💡 Note: If you didn't receive any prompt to install a Root Certificate, click the Actions > Trust Root Certificate button.

3. Enable localhost Proxy Mode

The following configures Fiddler to listen on a local port for proxy traffic.

  • Go to Tools > Fiddler Options.... Click on Connections tab.
    • Set Fiddler listens on port: 8888.
    • Enable Allow remote computers to connect.
    • Click Ok to save settings.

Fiddler Options - Tools HTTPS Tab

4. Reboot

5. Start Fiddler

💡 Reduce Noise: By default Fiddler will start capturing traffic of all applications at start up. Since we are only interested in debugging local traffic from a single .NET Application you can reduce noise by disabling capturing of live traffic and clearing the trace:

  • Press F12 or uncheck File > Capture Traffic. Disable Caputre Traffic
  • Clear the requests list: Clear Fiddler Request List

Keep Fiddler running.

6. Use the localhost proxy in .NET Application

Next, instruct your .NET Application to use the local Fiddler proxy for HTTP / HTTPS requests.

For this Coinbase Client library in this repository, use the EnableFiddlerDebugProxy setup method as demonstrated below:

var cfg = new Coinbase.ApiKeyConfig
{
   ApiKey = "fff",
   ApiSecret = "ggg"
};
var c = new Coinbase.CoinbaseClient(cfg);

c.EnableFiddlerDebugProxy("http://localhost.:8888");

var price = await c.Data.GetBuyPriceAsync("BTC-USD");
price.Data.Dump();

Then, inspect the Fiddler window to inspect HTTP traffic.

  • For HttpClient, general setup code is as follows:
Clone this wiki locally