diff --git a/.changeset/five-zoos-look.md b/.changeset/five-zoos-look.md new file mode 100644 index 000000000000..f882dee9bcf7 --- /dev/null +++ b/.changeset/five-zoos-look.md @@ -0,0 +1,5 @@ +--- +'@astrojs/cloudflare': patch +--- + +fix custom 404 pages not rendering diff --git a/packages/integrations/cloudflare/src/server.ts b/packages/integrations/cloudflare/src/server.ts index 6a76c06ff48c..032146691ea3 100644 --- a/packages/integrations/cloudflare/src/server.ts +++ b/packages/integrations/cloudflare/src/server.ts @@ -24,6 +24,11 @@ export function createExports(manifest: SSRManifest) { } // 404 + const _404Request = new Request(`${origin}/404`, request); + if (app.match(_404Request)) { + return app.render(_404Request); + } + return new Response(null, { status: 404, statusText: 'Not found',