From 985e9233422d3c3e5aea8d1b43ccc7b3a1bde72c Mon Sep 17 00:00:00 2001 From: Ara Sadoyan Date: Thu, 11 Dec 2025 13:37:40 +0100 Subject: [PATCH] to https redirect bug fix --- src/web/proxyhttp.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/web/proxyhttp.rs b/src/web/proxyhttp.rs index 1c1b133..d4d4c65 100644 --- a/src/web/proxyhttp.rs +++ b/src/web/proxyhttp.rs @@ -137,14 +137,20 @@ impl ProxyHttp for LB { if ctx.to_https || innermap.to_https { if let Some(stream) = session.stream() { if stream.get_ssl().is_none() { - if let Some(addr) = session.server_addr() { - if let Some((host, _)) = addr.to_string().split_once(':') { - let uri = session.req_header().uri.path_and_query().map_or("/", |pq| pq.as_str()); - let port = self.config.proxy_port_tls.unwrap_or(403); - ctx.to_https = true; - ctx.redirect_to = Arc::from(format!("https://{}:{}{}", host, port, uri)); - } + if let Some(host) = ctx.hostname.as_ref() { + let uri = session.req_header().uri.path_and_query().map_or("/", |pq| pq.as_str()); + let port = self.config.proxy_port_tls.unwrap_or(403); + ctx.to_https = true; + ctx.redirect_to = Arc::from(format!("https://{}:{}{}", host, port, uri)); } + // if let Some(addr) = session.server_addr() { + // if let Some((host, _)) = addr.to_string().split_once(':') { + // let uri = session.req_header().uri.path_and_query().map_or("/", |pq| pq.as_str()); + // let port = self.config.proxy_port_tls.unwrap_or(403); + // ctx.to_https = true; + // ctx.redirect_to = Arc::from(format!("https://{}:{}{}", host, port, uri)); + // } + // } } } }