Skip to content

Commit aa6557f

Browse files
committed
Fix service binding fetch URL mangling
When calling env.SERVICE.fetch(req) with a full URL, the handler was treating the entire URL as a pathname instead of extracting path+query. Use url::Url::parse to properly extract the path, matching the pattern used in try_internal_worker_route.
1 parent 0e34b96 commit aa6557f

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "openworkers-runner"
3-
version = "0.13.0"
3+
version = "0.13.1"
44
edition = "2024"
55
license = "MIT"
66
default-run = "openworkers-runner"

src/ops.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,12 +592,17 @@ impl OperationsHandler for RunnerOperations {
592592

593593
// Build the internal URL for the target worker
594594
// Runner listens on port 8080
595-
let path = if request.url.starts_with('/') {
595+
let path_and_query = if let Ok(url) = url::Url::parse(&request.url) {
596+
match url.query() {
597+
Some(q) => format!("{}?{}", url.path(), q),
598+
None => url.path().to_string(),
599+
}
600+
} else if request.url.starts_with('/') {
596601
request.url.clone()
597602
} else {
598603
format!("/{}", request.url)
599604
};
600-
let internal_url = format!("http://127.0.0.1:8080{}", path);
605+
let internal_url = format!("http://127.0.0.1:8080{}", path_and_query);
601606

602607
// Create the request with x-worker-id header to route to target
603608
let mut headers = request.headers.clone();

0 commit comments

Comments
 (0)