launchdarkly / java-server-sdk

LaunchDarkly Server-Side SDK for Java
Other
83 stars 56 forks source link

Using java client in behind a proxy #172

Closed jmuenchenberg closed 4 years ago

jmuenchenberg commented 4 years ago

Hi

I am evaluating LaunchDarkly for the use in our Spring-Boot Services. Unfortunately on my local machine I am behind our Corporate Proxy. So I tried to configure the Proxy: ` LDConfig config =new LDConfig.Builder() .proxyHost("some.proxy.de") .proxyPort(8080) .proxyPassword("some.password") .proxyUsername("some.technical.user") .build();

    ldClient = new LDClient("<sdk-key>", config);

`

This only led to timeouts in all attempts to connect to launchdarkly. Digging deeper into this I noticed, that the StreamProcessor, when building the EventSource does not pass on the proxy configuration from the config object to the EventSource.

I could fix this by adding the following code after line 257 in StreamProcessor.java. .proxy(config.proxy) .proxyAuthenticator(config.proxyAuthenticator)

My question: is the proxy configuration omitted here on purpose? Is there another way to configure the LDClient behind a proxy?

eli-darkly commented 4 years ago

Thanks for catching this. I believe that at some point we did some refactoring that resulted in EventSource having its own HTTP client instance, and we neglected to apply the same configuration logic. We need to improve the management of HTTP clients anyway (currently there is one contained in LDConfig, which is a little unfortunate) so we'll fix this as part of that.

jmuenchenberg commented 4 years ago

Great. You have any hint regarding the Timeline for that fix?

eli-darkly commented 4 years ago

There should be a patch release within a day or two.

eli-darkly commented 4 years ago

OK, there's a fix for this in the 4.8.1 release - please let us know once you've had a chance to retest.

jmuenchenberg commented 4 years ago

Works! Thanks.