Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for http_proxy #88

Open
butlerx opened this issue Jul 1, 2024 · 1 comment
Open

Support for http_proxy #88

butlerx opened this issue Jul 1, 2024 · 1 comment

Comments

@butlerx
Copy link

butlerx commented Jul 1, 2024

Is your feature request related to a problem? Please describe.

We use an HTTP Proxy (squid) to connect to the internet.
In the LD SDKs for other languages, we only have to specify HTTP_PROXY=http://proxy.internal:8080 to tell the SDK to connect to the internet via the proxy. This isn't supported in Rust though

Describe the solution you'd like
When HTTP_PROXY is defined in the environment the LD client would use the proxy to connect to the ld backend

Current workaround

use hyper::client::HttpConnector;
use hyper_proxy::{Intercept, Proxy, ProxyConnector};
use launchdarkly_server_sdk::{
    Client, ConfigBuilder, EventProcessorBuilder, ServiceEndpointsBuilder,
    StreamingDataSourceBuilder,
};
pub use launchdarkly_server_sdk::{Context, ContextBuilder};
.....
    let ld_config = if let Ok(http_proxy) = std::env::var("HTTP_PROXY") {
        let proxy_uri = http_proxy.parse()?;
        let proxy = Proxy::new(Intercept::All, proxy_uri);
        let connector = HttpConnector::new();
        let proxy_connector = ProxyConnector::from_proxy(connector, proxy).unwrap();
        let mut data_source_builder = StreamingDataSourceBuilder::default();
        data_source_builder.https_connector(proxy_connector.clone());
        let mut event_processor_builder = EventProcessorBuilder::default();
        event_processor_builder.https_connector(proxy_connector);
        ConfigBuilder::new(&ld_sdk_key)
            .event_processor(&event_processor_builder)
            .data_source(&data_source_builder)
            .build()
    } else {
        ConfigBuilder::new(&ld_sdk_key).build()
    };
@keelerm84
Copy link
Member

Thank you for filing this request. I cannot provide a timeline given competing priorities and timelines, but we are tracking this request internally and will notify you once we have added support.

Internal ticket number sc-249422.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants