diff --git a/.changeset/long-ligers-study.md b/.changeset/long-ligers-study.md new file mode 100644 index 000000000000..82b9e5188946 --- /dev/null +++ b/.changeset/long-ligers-study.md @@ -0,0 +1,5 @@ +--- +"wrangler": patch +--- + +Patches typing mismatches between us, undici and miniflare when proxying requests in pages dev, and also adds fallback 404 behavior which was missed diff --git a/packages/wrangler/src/pages.tsx b/packages/wrangler/src/pages.tsx index cf39db99a8f1..f5ec3721a742 100644 --- a/packages/wrangler/src/pages.tsx +++ b/packages/wrangler/src/pages.tsx @@ -474,6 +474,9 @@ const generateAssetsFetch = async ( deconstructedResponse.body = serveAsset(asset); return deconstructedResponse; } + + deconstructedResponse.status = 404; + return deconstructedResponse; }; let asset; @@ -787,7 +790,7 @@ export const pages: BuilderCallback = (yargs) => { const url = new URL(request.url); url.host = `127.0.0.1:${proxyPort}`; request = new Request(url.toString(), request); - return await fetch(request); + return await fetch(request.url, request); } catch (thrown) { console.error(`Could not proxy request: ${thrown}`);