Skip to content

Commit

Permalink
fix: @astrojs/clooudflare 404 handling
Browse files Browse the repository at this point in the history
  • Loading branch information
nrgnrg committed Jun 23, 2022
1 parent 1c944a1 commit 0fd18ec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/five-zoos-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/cloudflare': minor
---

fix custom 404 pages not rendering
5 changes: 5 additions & 0 deletions packages/integrations/cloudflare/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 0fd18ec

Please sign in to comment.