1
0
Fork 0
mirror of https://codeberg.org/icewind/haze.git synced 2026-11-30 04:30:47 +01:00

fix(proxy): Forward protocol when directly proxying HTTPS requests

This commit is contained in:
Louis Chmn 2026-11-10 17:53:58 +01:00
commit 0fda2eed2f

View file

@ -207,6 +207,7 @@ struct AppState {
instances: Arc<ActiveInstances>,
base_address: Arc<String>,
proxy_client: Arc<Client>,
https: bool,
}
async fn serve(
@ -242,6 +243,7 @@ async fn serve(
instances: instances.clone(),
base_address: base_address.clone(),
proxy_client: Arc::new(proxy_client),
https: acceptor.is_some() && !listen.starts_with('/'),
};
if !listen.starts_with('/') {
@ -375,6 +377,10 @@ async fn handler(state: AppState, mut req: Request<Incoming>) -> Result<Response
if let Some(host) = host {
req.headers_mut().insert(HOST, host.clone());
}
if state.https {
req.headers_mut()
.insert("x-forwarded-proto", HeaderValue::from_static("https"));
}
match hyper_reverse_proxy::call(
IpAddr::V4(Ipv4Addr::UNSPECIFIED),