We are trying to get proxy functionality to work in a .NET Core 3.0 (or 3.1) app on Windows. What we find is that the HTTPS_PROXY and HTTP_PROXY variables are recognized and processed as expected, but the default proxy does not appear to honor the NO_PROXY variable. Here is sample code:
HttpClient client = new HttpClient();
IWebProxy myProxy = HttpClient.DefaultProxy;
Uri target = new Uri(args[0]);
Uri proxy = myProxy.GetProxy(target);
Console.WriteLine($"Target proxy for {target} is {proxy} {myProxy.IsBypassed(target)}");
If I run this from PowerShell as such:
if (-not $env:path.Contains('c:\data\src')) {
$env:path = "$env:Path;C:\data\src\Local\DefaultProxy\bin\Debug\netcoreapp3.0"
}
$env:HTTPS_PROXY = 'http://10.11.10.10'
$env:NO_PROXY = '*'
DefaultProxy https://www.contoso.com
I get:
Target proxy for https://www.contoso.com/ is http://10.11.10.10/ False
I expect to get blank and true.
What should I change so that I can use NO_PROXY to exclude domains from the default proxy?