update error handling

This commit is contained in:
Jun Kurihara 2022-08-01 16:00:46 +09:00
commit f080f2e12d
No known key found for this signature in database
GPG key ID: 48ADFD173ED22B03
7 changed files with 23 additions and 14 deletions

View file

@ -24,10 +24,12 @@ pub(super) fn apply_upstream_options_to_header(
match opt {
UpstreamOption::OverrideHost => {
// overwrite HOST value with upstream hostname (like 192.168.xx.x seen from rpxy)
let upstream_host = upstream_base_uri.host().ok_or_else(|| anyhow!("none"))?;
let upstream_host = upstream_base_uri
.host()
.ok_or_else(|| anyhow!("No hostname is given in override_host option"))?;
headers
.insert(header::HOST, HeaderValue::from_str(upstream_host)?)
.ok_or_else(|| anyhow!("none"))?;
.ok_or_else(|| anyhow!("Failed to insert host header in override_host option"))?;
}
UpstreamOption::UpgradeInsecureRequests => {
// add upgrade-insecure-requests in request header if not exist