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:
parent
c3ec8c93b6
commit
add7caf896
1 changed files with 6 additions and 0 deletions
|
|
@ -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),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue