Enable Proxy support for OptimizelyHttpClient
mtstelz opened this issue · 4 comments
WIth the older version of the SDK because you were calling to get the json file yourself you were creating the ClosableHttpClient yourself and using that to get the file.
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpGet httpget = new HttpGet(configEndpoint);
RequestConfig requestConfig = RequestConfig.copy(defaultRequestConfig)
.setProxy(new HttpHost(proxyHost, proxyPort))
.build();
httpget.setConfig(requestConfig);With the new OptimizelyFactory it allows you to use withOptimizelyHttpClient but the OptimizelyHttpClient builder doesn't let your define specific HttpClient settings.
EventHandler eventHandler = AsyncEventHandler.builder()
.withQueueCapacity(20000)
.withNumWorkers(5)
.build();
ProjectConfigManager projectConfigManager = HttpProjectConfigManager.builder()
.withSdkKey(sdkKey)
.withOptimizelyHttpClient(OptimizelyHttpClient.builder().build())
.withPollingInterval(30, TimeUnit.MINUTES)
.build();
Optimizely optimizely = Optimizely.builder()
.withConfigManager(projectConfigManager)
.withEventHandler(eventHandler)
.build();I know an option is to set it globally but I only want to use the proxy for this call and not all outbound calls
👍 for this request.
Optimizely SDK would be using the proxy settings specified in https.proxyHost and https.proxyPort system properties. However, in microservice architecture, the service that wraps Optimizely SDK, will primarily make calls to other microservices in the cluster. The calls to Optimizlely infra would be the only outbound calls. Therefore it would be useful to be able to have an option to configure Optimizely SDK to use a proxy without impacting other HTTP calls.
Hi there! Is there any plan to resolve this issue?
We believe the following PR resolves this open issue:
#441