mirror of
https://codeberg.org/icewind/haze.git
synced 2026-11-30 12:40:48 +01:00
fix(proxy): Forward protocol when directly proxying HTTPS requests
This commit is contained in:
parent
9343bc9a61
commit
0fda2eed2f
1 changed files with 6 additions and 0 deletions
|
|
@ -207,6 +207,7 @@ struct AppState {
|
||||||
instances: Arc<ActiveInstances>,
|
instances: Arc<ActiveInstances>,
|
||||||
base_address: Arc<String>,
|
base_address: Arc<String>,
|
||||||
proxy_client: Arc<Client>,
|
proxy_client: Arc<Client>,
|
||||||
|
https: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn serve(
|
async fn serve(
|
||||||
|
|
@ -242,6 +243,7 @@ async fn serve(
|
||||||
instances: instances.clone(),
|
instances: instances.clone(),
|
||||||
base_address: base_address.clone(),
|
base_address: base_address.clone(),
|
||||||
proxy_client: Arc::new(proxy_client),
|
proxy_client: Arc::new(proxy_client),
|
||||||
|
https: acceptor.is_some() && !listen.starts_with('/'),
|
||||||
};
|
};
|
||||||
|
|
||||||
if !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 {
|
if let Some(host) = host {
|
||||||
req.headers_mut().insert(HOST, host.clone());
|
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(
|
match hyper_reverse_proxy::call(
|
||||||
IpAddr::V4(Ipv4Addr::UNSPECIFIED),
|
IpAddr::V4(Ipv4Addr::UNSPECIFIED),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue