diff --git a/web3_proxy/src/frontend/mod.rs b/web3_proxy/src/frontend/mod.rs index bfa7256d..4975a667 100644 --- a/web3_proxy/src/frontend/mod.rs +++ b/web3_proxy/src/frontend/mod.rs @@ -158,6 +158,7 @@ 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/status.rs b/web3_proxy/src/frontend/status.rs index 1199dc25..a6997c14 100644 --- a/web3_proxy/src/frontend/status.rs +++ b/web3_proxy/src/frontend/status.rs @@ -7,6 +7,8 @@ use super::{FrontendHealthCache, FrontendResponseCache, FrontendResponseCaches}; use crate::app::{Web3ProxyApp, APP_USER_AGENT}; use axum::{http::StatusCode, response::IntoResponse, Extension, Json}; use axum_macros::debug_handler; +use hashbrown::HashMap; +use http::HeaderMap; use serde_json::json; use std::sync::Arc; @@ -27,6 +29,18 @@ pub async fn health( } } +#[debug_handler] +pub async fn status_headers(headers: HeaderMap) -> impl IntoResponse { + let headers: HashMap, String> = headers + .into_iter() + .map(|(k, v)| (k.map(|k| k.to_string()), format!("{:?}", v))) + .collect(); + + let body = json!({ "headers": headers }); + + Json(body) +} + /// Very basic status page. /// /// TODO: replace this with proper stats and monitoring