From eabb52a6c0028bc4e4bf9cb1cf1add28ab3df185 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Tue, 10 May 2022 11:29:17 +0200 Subject: Doc + example + fix domain/host bug --- src/https.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/https.rs b/src/https.rs index 7dcf051..c3c4550 100644 --- a/src/https.rs +++ b/src/https.rs @@ -153,14 +153,20 @@ async fn handle( .ok_or_else(|| anyhow!("Missing host header"))? .to_str()? }; + let domain = match host.split_once(':') { + Some((domain, _port)) => domain, + _ => host, + }; + debug!("Matching on domain {}", domain); + let path = req.uri().path(); let accept_encoding = accept_encoding_fork::encodings(req.headers()).unwrap_or_else(|_| vec![]); let best_match = proxy_config .entries .iter() - .filter(|ent| { - ent.host.matches(host) + .filter(|ent| { + ent.host.matches(domain) && ent .path_prefix .as_ref() -- cgit v1.2.3