Description
The ForgeFetch tool (crates/forge_services/src/tool_services/fetch.rs) creates its own bare reqwest::Client via Client::new(), completely bypassing the proxy-aware, properly configured HTTP client used by the rest of the application (ForgeHttpInfra in crates/forge_infra/src/http.rs).
Since the workspace enables the hickory-dns Cargo feature for reqwest, the bare client attempts direct DNS resolution, which fails in corporate proxy environments even when HTTP_PROXY/HTTPS_PROXY environment variables are correctly set.
The main ForgeHttpInfra client already handles this correctly by calling .hickory_dns(false) on the builder — the fetch tool just needs the same treatment.
Steps to Reproduce
- Set
HTTP_PROXY and HTTPS_PROXY to a corporate proxy (e.g. http://proxy.corp:8080)
- Use the fetch tool to load any URL (e.g.
https://example.com)
- Observe:
Failed to fetch URL https://example.com/: error sending request for url
- Meanwhile,
curl https://example.com works fine (respects proxy env vars)
Root Cause
In crates/forge_services/src/tool_services/fetch.rs:
impl ForgeFetch {
pub fn new() -> Self {
Self { client: Client::new() } // bare client, no proxy/hickory config
}
}
vs. the properly configured client in crates/forge_infra/src/http.rs:
let mut client = reqwest::Client::builder()
// ... timeouts, TLS, etc.
.hickory_dns(http.hickory) // defaults to false — proxy-safe
// ...
Suggested Fix
Either:
- (Preferred) Have
ForgeFetch accept and use the shared ForgeHttpInfra client instead of constructing its own
- (Minimal) Disable hickory-dns on the fetch client:
pub fn new() -> Self {
Self {
client: Client::builder()
.hickory_dns(false)
.build()
.unwrap()
}
}
Related
Environment
- Forge Code version: 2.1.140
- OS: macOS (ARM64)
- Corporate proxy via
HTTP_PROXY/HTTPS_PROXY env vars
curl works correctly through the proxy
Description
The
ForgeFetchtool (crates/forge_services/src/tool_services/fetch.rs) creates its own barereqwest::ClientviaClient::new(), completely bypassing the proxy-aware, properly configured HTTP client used by the rest of the application (ForgeHttpInfraincrates/forge_infra/src/http.rs).Since the workspace enables the
hickory-dnsCargo feature forreqwest, the bare client attempts direct DNS resolution, which fails in corporate proxy environments even whenHTTP_PROXY/HTTPS_PROXYenvironment variables are correctly set.The main
ForgeHttpInfraclient already handles this correctly by calling.hickory_dns(false)on the builder — the fetch tool just needs the same treatment.Steps to Reproduce
HTTP_PROXYandHTTPS_PROXYto a corporate proxy (e.g.http://proxy.corp:8080)https://example.com)Failed to fetch URL https://example.com/: error sending request for urlcurl https://example.comworks fine (respects proxy env vars)Root Cause
In
crates/forge_services/src/tool_services/fetch.rs:vs. the properly configured client in
crates/forge_infra/src/http.rs:Suggested Fix
Either:
ForgeFetchaccept and use the sharedForgeHttpInfraclient instead of constructing its ownRelated
Environment
HTTP_PROXY/HTTPS_PROXYenv varscurlworks correctly through the proxy