diff --git a/src/lib.rs b/src/lib.rs index 188fc9b..da23c38 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -240,14 +240,6 @@ fn forward_uri(forward_url: &str, req: &Request) -> String { if forward_url_query.is_empty() { url.push_str(req.uri().query().unwrap_or("")); } else { - let forward_query_items = forward_url_query - .split('&') - .map(|el| { - let parts = el.split('=').collect::>(); - parts[0] - }) - .collect::>(); - let request_query_items = req .uri() .query() @@ -261,6 +253,14 @@ fn forward_uri(forward_url: &str, req: &Request) -> String { }) .collect::>(); + let forward_query_items = forward_url_query + .split('&') + .map(|el| { + let parts = el.split('=').collect::>(); + parts[0] + }) + .collect::>(); + for (key, value) in request_query_items.iter() { if !forward_query_items.contains(key) { url.push_str(key);