Compare commits

...

4 Commits

Author SHA1 Message Date
ea8224c400 v25.17.9
Some checks failed
Default (tags) / security (push) Failing after 0s
Default (tags) / test (push) Failing after 0s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2026-03-20 08:30:09 +00:00
da1cc58a3d fix(rustproxy-http): correct HTTP/3 host extraction and avoid protocol filtering during UDP route lookup 2026-03-20 08:30:09 +00:00
606c620849 v25.17.8
Some checks failed
Default (tags) / security (push) Failing after 0s
Default (tags) / test (push) Failing after 0s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2026-03-20 08:06:32 +00:00
4ae09ac6ae fix(rustproxy): use SNI-based certificate resolution for QUIC TLS connections 2026-03-20 08:06:32 +00:00
5 changed files with 33 additions and 37 deletions

View File

@@ -1,5 +1,18 @@
# Changelog # Changelog
## 2026-03-20 - 25.17.9 - fix(rustproxy-http)
correct HTTP/3 host extraction and avoid protocol filtering during UDP route lookup
- Use the URI host or strip the port from the Host header so HTTP/3 requests match routes consistently with TCP/HTTP handling.
- Remove protocol filtering from HTTP/3 route lookup because QUIC transport already constrains routing to UDP and protocol validation happens earlier.
## 2026-03-20 - 25.17.8 - fix(rustproxy)
use SNI-based certificate resolution for QUIC TLS connections
- Replaces static first-certificate selection with the shared CertResolver used by the TCP/TLS path.
- Ensures QUIC connections can present the correct certificate per requested domain.
- Keeps HTTP/3 ALPN configuration while improving multi-domain TLS handling.
## 2026-03-20 - 25.17.7 - fix(readme) ## 2026-03-20 - 25.17.7 - fix(readme)
document QUIC and HTTP/3 compatibility caveats document QUIC and HTTP/3 compatibility caveats

View File

@@ -1,6 +1,6 @@
{ {
"name": "@push.rocks/smartproxy", "name": "@push.rocks/smartproxy",
"version": "25.17.7", "version": "25.17.9",
"private": false, "private": false,
"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.", "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.",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",

View File

@@ -143,10 +143,11 @@ async fn handle_h3_request(
let uri = request.uri().clone(); let uri = request.uri().clone();
let path = uri.path().to_string(); let path = uri.path().to_string();
// Extract host from :authority or Host header // Extract host from :authority or Host header (strip port to match TCP/HTTP path)
let host = request.uri().authority() let host = request.uri().host()
.map(|a| a.as_str().to_string()) .map(|h| h.to_string())
.or_else(|| request.headers().get("host").and_then(|v| v.to_str().ok()).map(|s| s.to_string())) .or_else(|| request.headers().get("host").and_then(|v| v.to_str().ok())
.map(|h| h.split(':').next().unwrap_or(h).to_string()))
.unwrap_or_default(); .unwrap_or_default();
debug!("HTTP/3 {} {} (host: {}, client: {})", method, path, host, client_ip); debug!("HTTP/3 {} {} (host: {}, client: {})", method, path, host, client_ip);
@@ -160,7 +161,8 @@ async fn handle_h3_request(
tls_version: Some("TLSv1.3"), tls_version: Some("TLSv1.3"),
headers: None, headers: None,
is_tls: true, is_tls: true,
protocol: Some("http"), protocol: None, // Don't filter on protocol — transport: Udp already excludes TCP routes,
// and the route was already protocol-validated at the QUIC accept level.
transport: Some(TransportProtocol::Udp), transport: Some(TransportProtocol::Udp),
}; };

View File

@@ -1003,44 +1003,25 @@ impl RustProxy {
fn build_quic_tls_config( fn build_quic_tls_config(
tls_configs: &HashMap<String, TlsCertConfig>, tls_configs: &HashMap<String, TlsCertConfig>,
) -> Option<Arc<rustls::ServerConfig>> { ) -> Option<Arc<rustls::ServerConfig>> {
// Find the first available cert (prefer wildcard, then any) if tls_configs.is_empty() {
let cert_config = tls_configs.get("*")
.or_else(|| tls_configs.values().next());
let cert_config = match cert_config {
Some(c) => c,
None => return None,
};
// Parse cert chain from PEM
let mut cert_reader = std::io::BufReader::new(cert_config.cert_pem.as_bytes());
let certs: Vec<rustls::pki_types::CertificateDer<'static>> =
rustls_pemfile::certs(&mut cert_reader)
.filter_map(|r| r.ok())
.collect();
if certs.is_empty() {
return None; return None;
} }
// Parse private key from PEM // Reuse CertResolver for SNI-based cert selection (same as TCP/TLS path).
let mut key_reader = std::io::BufReader::new(cert_config.key_pem.as_bytes()); // This ensures QUIC connections get the correct certificate for each domain
let key = match rustls_pemfile::private_key(&mut key_reader) { // instead of a single static cert.
Ok(Some(key)) => key, let resolver = match rustproxy_passthrough::tls_handler::CertResolver::new(tls_configs) {
_ => return None, Ok(r) => r,
};
let mut tls_config = match rustls::ServerConfig::builder()
.with_no_client_auth()
.with_single_cert(certs, key)
{
Ok(c) => c,
Err(e) => { Err(e) => {
warn!("Failed to build QUIC TLS config: {}", e); warn!("Failed to build QUIC cert resolver: {}", e);
return None; return None;
} }
}; };
let mut tls_config = rustls::ServerConfig::builder()
.with_no_client_auth()
.with_cert_resolver(Arc::new(resolver));
// QUIC requires h3 ALPN // QUIC requires h3 ALPN
tls_config.alpn_protocols = vec![b"h3".to_vec()]; tls_config.alpn_protocols = vec![b"h3".to_vec()];

View File

@@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@push.rocks/smartproxy', name: '@push.rocks/smartproxy',
version: '25.17.7', version: '25.17.9',
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.' 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.'
} }