I am trying to hide my original IP address from the recipient, so I’m using a HttpClient with a proxy, however even when the proxy server is down, the request is still made successfully, only without the proxy, which isn’t the behavior I want.
Ideally the request should not be attempted if the proxy isn’t working, so as to always hide my original IP.
Is there a way to ensure this behavior?
Here is how I’m currently registering my HttpClient:
builder.Services
.AddHttpClient("ProxyName123")
.ConfigurePrimaryHttpMessageHandler(p => new HttpClientHandler
{
Proxy = new WebProxy("myproxyurl.com", 1234),
DefaultProxyCredentials = new NetworkCredential("myusername", "mypassword")
});