fix: fix conversion flow of http version in requests to upstream app servers

This commit is contained in:
Jun Kurihara 2023-08-09 03:16:04 +09:00
commit eea4f28c56
No known key found for this signature in database
GPG key ID: 48ADFD173ED22B03

View file

@ -363,19 +363,16 @@ where
} }
// If not specified (force_httpXX_upstream) and https, version is preserved except for http/3 // If not specified (force_httpXX_upstream) and https, version is preserved except for http/3
match req.version() { if upstream_chosen.uri.scheme() == Some(&Scheme::HTTP) {
Version::HTTP_3 => { // Change version to http/1.1 when destination scheme is http
debug!("HTTP/3 is currently unsupported for request to upstream."); debug!("Change version to http/1.1 when destination scheme is http.");
*req.version_mut() = Version::HTTP_2; *req.version_mut() = Version::HTTP_11;
} } else if req.version() == Version::HTTP_3 {
_ => { // HTTP/3 is always https
if upstream_chosen.uri.scheme() == Some(&Scheme::HTTP) { debug!("HTTP/3 is currently unsupported for request to upstream.");
// Change version to http/1.1 when destination scheme is http *req.version_mut() = Version::HTTP_2;
debug!("Change version to http/1.1 when destination scheme is http.");
*req.version_mut() = Version::HTTP_11;
}
}
} }
apply_upstream_options_to_request_line(req, upstream_group)?; apply_upstream_options_to_request_line(req, upstream_group)?;
Ok(context) Ok(context)