diff --git a/src/http/http11.rs b/src/http/http11.rs index 4d22956..9aeb30c 100644 --- a/src/http/http11.rs +++ b/src/http/http11.rs @@ -8,7 +8,7 @@ use crate::{ http::{ ArcProxyData, HttpError, HttpLog, Protocol, ProxyData, ProxyResponse, ProxyType, TimedResponse, X_FORWARDED_FOR, X_FORWARDED_HOST, X_FORWARDED_PORT, X_FORWARDED_PROTO, - append_to_header, http_log, + append_to_header, http_log, proxy_handler_inner, }, keepalive::KeepaliveAlias, telemetry::{TELEMETRY_COUNTER_HTTP_REQUESTS, TELEMETRY_KEY_HOSTNAME}, @@ -89,7 +89,8 @@ where version => return Err(HttpError::InvalidHttpVersion(version)), }; if host != host_header_or_uri { - return Err(HttpError::MismatchedHostHeader); + // Fallback to legacy behavior + return proxy_handler_inner(request, tcp_address, None, proxy_data).await; } let ip = tcp_address.ip().to_canonical(); diff --git a/src/http/http2.rs b/src/http/http2.rs index 88e1ee5..415b6db 100644 --- a/src/http/http2.rs +++ b/src/http/http2.rs @@ -6,7 +6,7 @@ use crate::{ http::{ ArcProxyData, HttpError, HttpLog, Protocol, ProxyData, ProxyResponse, ProxyType, TimedResponse, X_FORWARDED_FOR, X_FORWARDED_HOST, X_FORWARDED_PORT, X_FORWARDED_PROTO, - append_to_header, http_log, + append_to_header, http_log, proxy_handler_inner, }, keepalive::KeepaliveAlias, telemetry::{TELEMETRY_COUNTER_HTTP_REQUESTS, TELEMETRY_KEY_HOSTNAME}, @@ -71,7 +71,8 @@ where return Err(HttpError::MissingHostHeader); }; if host != host_uri { - return Err(HttpError::MismatchedHostHeader); + // Fallback to legacy behavior + return proxy_handler_inner(request, tcp_address, None, proxy_data).await; }; let ip = tcp_address.ip().to_canonical(); diff --git a/src/http/mod.rs b/src/http/mod.rs index 952e352..91f1af5 100644 --- a/src/http/mod.rs +++ b/src/http/mod.rs @@ -243,8 +243,6 @@ pub(crate) enum HttpError { MissingHostHeader, #[error("Invalid Host header")] InvalidHostHeader, - #[error("Mismatched Host header")] - MismatchedHostHeader, #[error("Invalid HTTP version {0:?}")] InvalidHttpVersion(Version), #[error("Invalid URI: {0:?}")] @@ -276,7 +274,6 @@ impl IntoResponse for HttpError { HttpError::HeaderToStrError(_) | HttpError::MissingUriHost | HttpError::MissingHostHeader - | HttpError::MismatchedHostHeader | HttpError::InvalidHostHeader | HttpError::InvalidHttpVersion(_) | HttpError::InvalidUri(_) @@ -478,7 +475,7 @@ where } #[inline] -async fn proxy_handler_inner( +pub(crate) async fn proxy_handler_inner( mut request: Request, tcp_address: SocketAddr, fingerprint: Option,