From 70d5c09d3ee1a6a61e0c8ced3c13a30324f46ae1 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Mon, 12 Jun 2023 11:38:34 -0700 Subject: [PATCH] clean up redirect url --- web3_proxy/src/frontend/rpc_proxy_ws.rs | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/web3_proxy/src/frontend/rpc_proxy_ws.rs b/web3_proxy/src/frontend/rpc_proxy_ws.rs index cc8a3225..1f37585c 100644 --- a/web3_proxy/src/frontend/rpc_proxy_ws.rs +++ b/web3_proxy/src/frontend/rpc_proxy_ws.rs @@ -270,27 +270,15 @@ async fn _websocket_handler_with_key( (Some(redirect_public_url), _, None) => { Ok(Redirect::permanent(redirect_public_url).into_response()) } - (_, Some(redirect_rpc_key_url), rpc_key_id) => { + (_, Some(redirect_rpc_key_url), Some(rpc_key_id)) => { let reg = Handlebars::new(); - if authorization.checks.rpc_secret_key_id.is_none() { - // i don't think this is possible - Err(Web3ProxyError::StatusCode( - StatusCode::UNAUTHORIZED, - "AUTHORIZATION header required".into(), - None, - )) - } else { - let redirect_rpc_key_url = reg - .render_template( - redirect_rpc_key_url, - &json!({ "rpc_key_id": rpc_key_id }), - ) - .expect("templating should always work"); + let redirect_rpc_key_url = reg + .render_template(redirect_rpc_key_url, &json!({ "rpc_key_id": rpc_key_id })) + .expect("templating should always work"); - // this is not a websocket. redirect to a page for this user - Ok(Redirect::permanent(&redirect_rpc_key_url).into_response()) - } + // this is not a websocket. redirect to a page for this user + Ok(Redirect::permanent(&redirect_rpc_key_url).into_response()) } // any other combinations get a simple error _ => Err(Web3ProxyError::StatusCode(