Skip to content

fix: never send HTTP/3 requests past the proxy - #598

Draft
metalwarrior665 wants to merge 1 commit into
masterfrom
fix/http3-proxy-guard
Draft

metalwarrior665 wants to merge 1 commit into
masterfrom
fix/http3-proxy-guard

Conversation

@metalwarrior665

Copy link
Copy Markdown
Member

reqwest sends HTTP/3 requests through its own QUIC connector (h3_client/connect.rs), which resolves the host and connects directly. Only the TCP connector knows about proxies, both in the crates.io release and in the patched revision impit uses. So with with_http3() and a proxy:

  1. The first request to a host goes through the proxy over HTTP/2.
  2. When the host advertises h3 (Alt-Svc or its HTTPS DNS record), impit caches it as HTTP/3-capable.
  3. Later requests to that host go out over QUIC from the machine's own IP address.

Reproduced on master with with_http3(), a local logging CONNECT proxy, and https://www.google.com/:

  • Normal requests went through the proxy, one CONNECT www.google.com:443 each.
  • The http3_prior_knowledge request never reached the proxy. strace shows the QUIC packets going straight from the process to 142.251.153.119:443.
  • H3Engine's HTTPS-record lookup also went straight to 8.8.8.8 / 8.8.4.4.

HTTP/3 is off by default, so only http3: true together with a proxy is affected.

With this change, HTTP/3 is disabled with a warning whenever a proxy is set: with with_proxy, or in HTTPS_PROXY / ALL_PROXY, the variables reqwest reads for HTTPS. A request with http3_prior_knowledge then fails with Http3Disabled, whose message now mentions the proxy. I chose this over failing at build time so existing http3: true plus proxy setups keep working, just over HTTP/2. It's easy to flip if you'd rather error.

I also removed .with_http3() from the ImpitBuilder doc example, which combined it with a proxy.

The other half of the original #595, making HTTP/3 an opt-in Cargo feature, stays in #595.


Generated by Claude Code

reqwest sends HTTP/3 requests through its own QUIC connector, which ignores
proxies. With `with_http3()` and a proxy, the first request to a host went
through the proxy, and once the host advertised h3 (Alt-Svc or its HTTPS DNS
record), later requests went out over QUIC from the machine's own IP address.
HTTP/3 is now disabled (with a warning) when a proxy is set, either with
`with_proxy` or in `HTTPS_PROXY` / `ALL_PROXY`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0148RYR4BTGyCYHENSRZjC3S

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

3 participants