Proxying HttpClient requests through Fiddler

To proxy external requests set the Proxy property of HttpClientHandler:

    private static HttpClient client 
        = new HttpClient(new HttpClientHandler()
        {
            Proxy = new WebProxy("localhost", 8888)
        });

This will not work for localhost requests since these bypass proxies by default. Instead you can suffix the request URL with .fiddler. This is why it is a good idea to store your API endpoints in app/web.config:

<add key="ApiEndpoint" value="http://localhost.fiddler:49978" />

Ben Foster

About Me

I'm a software engineer and aspiring entrepreneur with 15 years experience in tech and have worked with companies of all sizes in areas such as healthcare, agriculture, recruitment, e-commerce and finance. I founded my first startup Fabrik in 2011.

I now head up the engineering team at Checkout.com. If you're interested in working in an exciting and innovative fin-tech company, drop me a message.

Creative Commons Licence