From 8d6f4dc6025da956a71790de8d1e16cf44e2bd18 Mon Sep 17 00:00:00 2001 From: Daniel Freire Date: Tue, 7 Jan 2025 16:56:08 -0300 Subject: [PATCH 1/3] fix: keep the URI query after stripping it --- server/src/middleware/http/proxy_get_request.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/src/middleware/http/proxy_get_request.rs b/server/src/middleware/http/proxy_get_request.rs index df479eacdb..a5cab691ee 100644 --- a/server/src/middleware/http/proxy_get_request.rs +++ b/server/src/middleware/http/proxy_get_request.rs @@ -149,8 +149,12 @@ where (Some(method), &Method::GET) => { // RPC methods are accessed with `POST`. *req.method_mut() = Method::POST; - // Precautionary remove the URI. - *req.uri_mut() = Uri::from_static("/"); + // Precautionary remove the URI path. + *req.uri_mut() = if let Some(query) = req.uri().query() { + Uri::from_str(&format!("/?{}", query)).expect("Valid uri; qed") + } else { + Uri::from_static("/") + }; // Requests must have the following headers: req.headers_mut().insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); req.headers_mut().insert(ACCEPT, HeaderValue::from_static("application/json")); From 29ad7ab6aec9f91241e17709c08d93494d540274 Mon Sep 17 00:00:00 2001 From: Daniel Freire Date: Tue, 7 Jan 2025 17:02:14 -0300 Subject: [PATCH 2/3] Update proxy_get_request.rs --- server/src/middleware/http/proxy_get_request.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/server/src/middleware/http/proxy_get_request.rs b/server/src/middleware/http/proxy_get_request.rs index a5cab691ee..d8e1a3e160 100644 --- a/server/src/middleware/http/proxy_get_request.rs +++ b/server/src/middleware/http/proxy_get_request.rs @@ -40,6 +40,7 @@ use jsonrpsee_types::{Id, RequestSer}; use std::collections::HashMap; use std::future::Future; use std::pin::Pin; +use std::str::FromStr; use std::sync::Arc; use std::task::{Context, Poll}; use tower::{Layer, Service}; From 0c0da5ae7e95217ed31a73711f3e8bd859f05638 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Wed, 8 Jan 2025 16:07:14 +0100 Subject: [PATCH 3/3] Update server/src/middleware/http/proxy_get_request.rs --- server/src/middleware/http/proxy_get_request.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/middleware/http/proxy_get_request.rs b/server/src/middleware/http/proxy_get_request.rs index d8e1a3e160..49e32d657d 100644 --- a/server/src/middleware/http/proxy_get_request.rs +++ b/server/src/middleware/http/proxy_get_request.rs @@ -152,7 +152,7 @@ where *req.method_mut() = Method::POST; // Precautionary remove the URI path. *req.uri_mut() = if let Some(query) = req.uri().query() { - Uri::from_str(&format!("/?{}", query)).expect("Valid uri; qed") + Uri::from_str(&format!("/?{}", query)).expect("The query comes from a valid URI; qed") } else { Uri::from_static("/") };