Skip to content

Commit

Permalink
fix: ensure proper property passing
Browse files Browse the repository at this point in the history
  • Loading branch information
antho-bunny committed Sep 18, 2024
1 parent ebab9de commit 54e064e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/twenty-cycles-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@bunny.net/edgescript-sdk": patch
---

Ensure proper property passing for middleware url
9 changes: 8 additions & 1 deletion libs/bunny-sdk/src/net/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,15 @@ function servePullZone(
}
default: {
const middlewareHandler: ServerHandler = async (req) => {
const url = new URL(req.url);
const origin_url = new URL(raw_options.url);

url.protocol = origin_url.protocol;
url.hostname = origin_url.hostname;
url.port = origin_url.port;

let mutableRequest = new Request(
raw_options.url,
url,
req as unknown as RequestInit,
);

Expand Down

0 comments on commit 54e064e

Please sign in to comment.