Skip to content

Instantly share code, notes, and snippets.

@dariusz-wozniak
Created March 28, 2025 11:01
Show Gist options
  • Save dariusz-wozniak/7174d31f15ff210270a6667948c0dc0e to your computer and use it in GitHub Desktop.
Save dariusz-wozniak/7174d31f15ff210270a6667948c0dc0e to your computer and use it in GitHub Desktop.
Proxy for ASP.NET Core
services.AddHttpClient("ProxyClient", client =>
{
// Optionally configure the client here
}).ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler
{
Proxy = new WebProxy("http://127.0.0.1:8888")
{
BypassProxyOnLocal = false,
UseDefaultCredentials = true
},
UseProxy = true
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment