Skip to content

Commit

Permalink
fix: @astrojs/clooudflare 404 handling (#3695)
Browse files Browse the repository at this point in the history
  • Loading branch information
nrgnrg authored Jun 24, 2022
1 parent 6a60474 commit 0d667d0
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': patch
---

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 0d667d0

Please sign in to comment.