Software Development

A journal for sharing all things software development related

Proxy HTTP Requests through Fiddler (.NET Core)

Fri, 28 Aug 2020 21:32 UTC by garethbrown

Without some non standard configuration, .NET does not route HTTP requests from the application / server through the Fiddler HTTP debugger, and seems to ignore the Local Area Network (LAN) Settings that Fiddler temporarily applies (see Internet Options in Control Panel).

Configure for HttpClient using HttpClientHandler options

This can be done by configuring an HttpClientHandler for the HttpClient:

// Note that HttpClient is intended to be instantiated once per application, rather than per-use.

using (var client = new HttpClient(
    handler: new HttpClientHandler
        // 8888 = Fiddler standard port
        Proxy = new WebProxy(new Uri("")),
        UseProxy = true
    var result = client.GetAsync("").Result;

Configure Globally using environment variables

Alternatively this can be done globally by setting the ALL_PROXY environment variable:

"ExampleApp": {
  "environmentVariables": {
    "ASPNETCORE_ENVIRONMENT": "Development",
    "ALL_PROXY": "http://localhost:8888"

Note that the ALL_PROXY setting seems a little 'sticky', in that it didn't appear to immediatley revert after a full rebuild and restart of the application, but I didn't spend long investigating this.

Additional proxy environment variable options can be found here:

The information on this site is provided “AS IS” and without warranties of any kind either
express or implied. To the fullest extent permissible pursuant to applicable laws, the author disclaims all warranties, express or implied, including, but not limited to, implied warranties of merchantability, non-infringement and suitability for a particular purpose.

UI block loader
One moment please ...