From b0c5d2b0eb450146d2db3cb592aecf85851d3277 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Fri, 10 Mar 2023 09:45:55 -0800 Subject: [PATCH] remove debugging headers --- web3_proxy/src/frontend/mod.rs | 1 - web3_proxy/src/frontend/rpc_proxy_http.rs | 16 ---------------- web3_proxy/src/frontend/status.rs | 17 ----------------- 3 files changed, 34 deletions(-) diff --git a/web3_proxy/src/frontend/mod.rs b/web3_proxy/src/frontend/mod.rs index 4975a667..bfa7256d 100644 --- a/web3_proxy/src/frontend/mod.rs +++ b/web3_proxy/src/frontend/mod.rs @@ -158,7 +158,6 @@ pub async fn serve(port: u16, proxy_app: Arc) -> anyhow::Result<() // .route("/health", get(status::health)) .route("/status", get(status::status)) - .route("/status/headers", get(status::status_headers)) // // User stuff // diff --git a/web3_proxy/src/frontend/rpc_proxy_http.rs b/web3_proxy/src/frontend/rpc_proxy_http.rs index 1ddd93f5..d27f1533 100644 --- a/web3_proxy/src/frontend/rpc_proxy_http.rs +++ b/web3_proxy/src/frontend/rpc_proxy_http.rs @@ -99,15 +99,6 @@ async fn _proxy_web3_rpc( .expect("W3P-BACKEND-RPCS should always parse"), ); - // TODO: add a header if a backend rpc was used - - headers.insert( - "X-W3P-CLIENT-IP", - ip.to_string() - .parse() - .expect("X-CLIENT-IP should always parse"), - ); - Ok(response) } @@ -272,13 +263,6 @@ async fn _proxy_web3_rpc_with_key( .expect("W3P-BACKEND-RPCS should always parse"), ); - headers.insert( - "X-W3P-CLIENT-IP", - ip.to_string() - .parse() - .expect("X-CLIENT-IP should always parse"), - ); - if let Some(rpc_secret_key_id) = rpc_secret_key_id { headers.insert( "X-W3P-KEY-ID", diff --git a/web3_proxy/src/frontend/status.rs b/web3_proxy/src/frontend/status.rs index 0bb6c90e..53cf5824 100644 --- a/web3_proxy/src/frontend/status.rs +++ b/web3_proxy/src/frontend/status.rs @@ -29,23 +29,6 @@ pub async fn health( } } -#[debug_handler] -pub async fn status_headers(headers: HeaderMap) -> impl IntoResponse { - let headers: HashMap = headers - .into_iter() - .map(|(k, v)| { - ( - k.map(|k| k.to_string()).unwrap_or_default(), - format!("{:?}", v), - ) - }) - .collect(); - - let body = json!({ "headers": headers }); - - Json(body) -} - /// Very basic status page. /// /// TODO: replace this with proper stats and monitoring