From c83c43194b28c548b50ea506cc464a0a3e21f802 Mon Sep 17 00:00:00 2001 From: Juergen Kunz Date: Mon, 23 Mar 2026 11:11:55 +0000 Subject: [PATCH] fix(rustproxy-http): include the upstream request URL when caching H3 Alt-Svc discoveries --- changelog.md | 6 ++++++ rust/crates/rustproxy-http/src/proxy_service.rs | 12 +++++++++--- ts/00_commitinfo_data.ts | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/changelog.md b/changelog.md index 7214e3a..311927f 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## 2026-03-23 - 26.2.1 - fix(rustproxy-http) +include the upstream request URL when caching H3 Alt-Svc discoveries + +- Tracks the request path that triggered Alt-Svc discovery in connection activity state +- Adds request URL context to Alt-Svc debug logging and protocol cache insertion reasons for better traceability + ## 2026-03-23 - 26.2.0 - feat(protocol-cache) add sliding TTL re-probing and eviction for backend protocol detection diff --git a/rust/crates/rustproxy-http/src/proxy_service.rs b/rust/crates/rustproxy-http/src/proxy_service.rs index b1e7e28..0d29774 100644 --- a/rust/crates/rustproxy-http/src/proxy_service.rs +++ b/rust/crates/rustproxy-http/src/proxy_service.rs @@ -47,6 +47,8 @@ pub struct ConnActivity { /// checks the backend's original response headers for Alt-Svc before our /// ResponseFilter injects its own. None when not in auto-detect mode or after H3 failure. alt_svc_cache_key: Option, + /// The upstream request path that triggered Alt-Svc discovery. Logged for traceability. + alt_svc_request_url: Option, } impl ConnActivity { @@ -58,6 +60,7 @@ impl ConnActivity { start: std::time::Instant::now(), active_requests: None, alt_svc_cache_key: None, + alt_svc_request_url: None, } } } @@ -371,7 +374,7 @@ impl HttpProxyService { let cn = cancel_inner.clone(); let la = Arc::clone(&la_inner); let st = start; - let ca = ConnActivity { last_activity: Arc::clone(&la_inner), start, active_requests: Some(Arc::clone(&ar_inner)), alt_svc_cache_key: None }; + let ca = ConnActivity { last_activity: Arc::clone(&la_inner), start, active_requests: Some(Arc::clone(&ar_inner)), alt_svc_cache_key: None, alt_svc_request_url: None }; async move { let req = req.map(|body| BoxBody::new(body)); let result = svc.handle_request(req, peer, port, cn, ca).await; @@ -775,6 +778,7 @@ impl HttpProxyService { // the backend's original Alt-Svc header before ResponseFilter injects our own. if is_auto_detect_mode { conn_activity.alt_svc_cache_key = Some(protocol_cache_key.clone()); + conn_activity.alt_svc_request_url = Some(upstream_path.to_string()); } // --- H3 path: try QUIC connection before TCP --- @@ -1979,8 +1983,10 @@ impl HttpProxyService { if let Some(ref cache_key) = conn_activity.alt_svc_cache_key { if let Some(alt_svc) = resp_parts.headers.get("alt-svc").and_then(|v| v.to_str().ok()) { if let Some(h3_port) = parse_alt_svc_h3_port(alt_svc) { - debug!(h3_port, "Backend advertises H3 via Alt-Svc"); - self.protocol_cache.insert_h3(cache_key.clone(), h3_port, "Alt-Svc response header"); + let url = conn_activity.alt_svc_request_url.as_deref().unwrap_or("-"); + debug!(h3_port, url, "Backend advertises H3 via Alt-Svc"); + let reason = format!("Alt-Svc response header ({})", url); + self.protocol_cache.insert_h3(cache_key.clone(), h3_port, &reason); } } } diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 01c07f1..10d53ab 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@push.rocks/smartproxy', - version: '26.2.0', + version: '26.2.1', description: 'A powerful proxy package with unified route-based configuration for high traffic management. Features include SSL/TLS support, flexible routing patterns, WebSocket handling, advanced security options, and automatic ACME certificate management.' }