aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2022-05-10 11:29:17 +0200
committerQuentin Dufour <quentin@deuxfleurs.fr>2022-05-10 11:29:17 +0200
commiteabb52a6c0028bc4e4bf9cb1cf1add28ab3df185 (patch)
tree14cdbd56685be7a82a2a2ebc51cfbfec8c9807db /src
parentdf4a36990c799901463d63c78de0f0672b675688 (diff)
downloadtricot-eabb52a6c0028bc4e4bf9cb1cf1add28ab3df185.tar.gz
tricot-eabb52a6c0028bc4e4bf9cb1cf1add28ab3df185.zip
Doc + example + fix domain/host bug
Diffstat (limited to 'src')
-rw-r--r--src/https.rs10
1 files changed, 8 insertions, 2 deletions
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()