fix: change set-upstream-host as a default option

This commit is contained in:
Jun Kurihara 2024-01-10 14:44:51 +09:00
commit 3fcea9a28c
No known key found for this signature in database
GPG key ID: 6D3FEE70E498C15B
5 changed files with 23 additions and 18 deletions

View file

@ -1,10 +1,17 @@
use crate::error::*;
/// Options for request message to be sent to upstream.
#[derive(Debug, Clone, Hash, Eq, PartialEq)]
pub enum UpstreamOption {
/// Keep original host header, which is prioritized over SetUpstreamHost
KeepOriginalHost,
/// Overwrite host header with upstream hostname
SetUpstreamHost,
/// Add upgrade-insecure-requests header
UpgradeInsecureRequests,
/// Force HTTP/1.1 upstream
ForceHttp11Upstream,
/// Force HTTP/2 upstream
ForceHttp2Upstream,
// TODO: Adds more options for heder override
}
@ -13,6 +20,7 @@ impl TryFrom<&str> for UpstreamOption {
fn try_from(val: &str) -> RpxyResult<Self> {
match val {
"keep_original_host" => Ok(Self::KeepOriginalHost),
"set_upstream_host" => Ok(Self::SetUpstreamHost),
"upgrade_insecure_requests" => Ok(Self::UpgradeInsecureRequests),
"force_http11_upstream" => Ok(Self::ForceHttp11Upstream),
"force_http2_upstream" => Ok(Self::ForceHttp2Upstream),