aboutsummaryrefslogtreecommitdiff
path: root/src/reverse_proxy.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/reverse_proxy.rs')
-rw-r--r--src/reverse_proxy.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/reverse_proxy.rs b/src/reverse_proxy.rs
index 401f4b1..9d7780c 100644
--- a/src/reverse_proxy.rs
+++ b/src/reverse_proxy.rs
@@ -139,3 +139,26 @@ pub async fn call(
let proxied_response = create_proxied_response(response);
Ok(proxied_response)
}
+
+pub async fn call_https(
+ client_ip: IpAddr,
+ forward_uri: &str,
+ request: Request<Body>,
+) -> Result<Response<Body>> {
+ let proxied_request = create_proxied_request(client_ip, &forward_uri, request)?;
+
+ trace!("Proxied request (HTTPS): {:?}", proxied_request);
+
+ let https = hyper_rustls::HttpsConnectorBuilder::new()
+ .with_native_roots()
+ .https_only()
+ .enable_http1()
+ .build();
+ let client: Client<_, hyper::Body> = Client::builder().build(https);
+ let response = client.request(proxied_request).await?;
+
+ trace!("Inner response (HTTPS): {:?}", response);
+
+ let proxied_response = create_proxied_response(response);
+ Ok(proxied_response)
+}