Skip to content

fix(auth): route HTTPS traffic through HTTP_PROXY when no HTTPS proxy is set#2744

Open
tusharmath wants to merge 11 commits intomainfrom
http-proxy-auth
Open

fix(auth): route HTTPS traffic through HTTP_PROXY when no HTTPS proxy is set#2744
tusharmath wants to merge 11 commits intomainfrom
http-proxy-auth

Conversation

@tusharmath
Copy link
Copy Markdown
Collaborator

No description provided.

Comment on lines +54 to +66
fn with_http_config(self, config: &HttpConfig) -> Self {
self.connect_timeout(Duration::from_secs(config.connect_timeout))
.read_timeout(Duration::from_secs(config.read_timeout))
.pool_idle_timeout(Duration::from_secs(config.pool_idle_timeout))
.pool_max_idle_per_host(config.pool_max_idle_per_host)
.redirect(Policy::limited(config.max_redirects))
.hickory_dns(config.hickory)
.http2_adaptive_window(config.adaptive_window)
.http2_keep_alive_interval(config.keep_alive_interval.map(Duration::from_secs))
.http2_keep_alive_timeout(Duration::from_secs(config.keep_alive_timeout))
.http2_keep_alive_while_idle(config.keep_alive_while_idle)
.with_tls_config(config)
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing proxy fallback in with_http_config

The with_http_config method applies all HTTP configuration including timeouts, connection pooling, and TLS settings, but it does NOT call .with_proxy_fallback(). This means the main LLM client created in llm_client.rs:27-30 will not benefit from the HTTP_PROXY fallback logic that is the core purpose of this PR.

While auth and MCP clients correctly chain .with_proxy_fallback()? before .with_tls_config(), the main HTTP client used for LLM API calls will still bypass the proxy in corporate environments where only HTTP_PROXY is set.

Fix:

fn with_http_config(self, config: &HttpConfig) -> anyhow::Result<Self> {
    Ok(self.connect_timeout(Duration::from_secs(config.connect_timeout))
        .read_timeout(Duration::from_secs(config.read_timeout))
        .pool_idle_timeout(Duration::from_secs(config.pool_idle_timeout))
        .pool_max_idle_per_host(config.pool_max_idle_per_host)
        .redirect(Policy::limited(config.max_redirects))
        .hickory_dns(config.hickory)
        .http2_adaptive_window(config.adaptive_window)
        .http2_keep_alive_interval(config.keep_alive_interval.map(Duration::from_secs))
        .http2_keep_alive_timeout(Duration::from_secs(config.keep_alive_timeout))
        .http2_keep_alive_while_idle(config.keep_alive_while_idle)
        .with_proxy_fallback()?
        .with_tls_config(config))
}

Note the method now returns anyhow::Result<Self> instead of Self to handle the error from with_proxy_fallback(), and the call to .build() in llm_client.rs:29 needs to be changed from .unwrap() to proper error handling.

Suggested change
fn with_http_config(self, config: &HttpConfig) -> Self {
self.connect_timeout(Duration::from_secs(config.connect_timeout))
.read_timeout(Duration::from_secs(config.read_timeout))
.pool_idle_timeout(Duration::from_secs(config.pool_idle_timeout))
.pool_max_idle_per_host(config.pool_max_idle_per_host)
.redirect(Policy::limited(config.max_redirects))
.hickory_dns(config.hickory)
.http2_adaptive_window(config.adaptive_window)
.http2_keep_alive_interval(config.keep_alive_interval.map(Duration::from_secs))
.http2_keep_alive_timeout(Duration::from_secs(config.keep_alive_timeout))
.http2_keep_alive_while_idle(config.keep_alive_while_idle)
.with_tls_config(config)
}
fn with_http_config(self, config: &HttpConfig) -> anyhow::Result<Self> {
Ok(self.connect_timeout(Duration::from_secs(config.connect_timeout))
.read_timeout(Duration::from_secs(config.read_timeout))
.pool_idle_timeout(Duration::from_secs(config.pool_idle_timeout))
.pool_max_idle_per_host(config.pool_max_idle_per_host)
.redirect(Policy::limited(config.max_redirects))
.hickory_dns(config.hickory)
.http2_adaptive_window(config.adaptive_window)
.http2_keep_alive_interval(config.keep_alive_interval.map(Duration::from_secs))
.http2_keep_alive_timeout(Duration::from_secs(config.keep_alive_timeout))
.http2_keep_alive_while_idle(config.keep_alive_while_idle)
.with_proxy_fallback()?
.with_tls_config(config))
}

Spotted by Graphite

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@github-actions github-actions bot added the type: fix Iterations on existing features or infrastructure. label Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: fix Iterations on existing features or infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant