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 12+ years experience in the tech industry and have worked with startups and SMB’s in areas such as healthcare, recruitment and e-commerce (I even worked in enterprise, once). I founded my first startup Fabrik in 2011.

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

Creative Commons Licence