Closed wags1999 closed 2 years ago
Looks like I can make it work by specifying a custom MessageHandler, and that will be used by both the EventProcessor and DataSource.
var config = Configuration.Builder("my-sdk-key")
.Http(
Components.HttpConfiguration()
.MessageHandler(new HttpClientHandler() {
Proxy = new System.Net.WebProxy(new Uri("http://my-proxy:8080")),
UseProxy = true })
)
.Build();
Should the Proxy option be deprecated, or should EventSource be fixed to use it?
I don't think the bug would be in EventSource itself, but rather, the way the SDK is constructing EventSource... since EventSource does not know anything about the SDK's configuration types and just uses whatever is passed to it. If you look at the API for this library, it does not have a separate Proxy option but relies on the caller to configure a MessageHandler with a Proxy if desired, since that is where the proxy settings really live in .NET. The SDK's Proxy option is a shortcut for doing that, but it seems the SDK is not applying it consistently.
Would you mind re-filing this in https://github.com/launchdarkly/dotnet-server-sdk/issues ?
I'm configuring an LdClient as described in https://docs.launchdarkly.com/sdk/server-side/dotnet/migration-5-to-6#understanding-changes-to-networking:
However, when EventSource creates its HttpClient, it doesn't use the Http/Proxy configuration, resulting in errors. From the log:
The only workaround we've found is to set the global proxy as per instructions here: https://docs.microsoft.com/en-us/dotnet/framework/network-programming/proxy-configuration
.NET 4.7.2 LaunchDarkly.ServerSdk 6.1.0 LaunchDarkly.EventSource 4.1.2 LaunchDarkly.CommonSdk 5.1.0