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 4d8a5ea
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
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
7 changes: 6 additions & 1 deletion packages/integrations/cloudflare/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@ export function createExports(manifest: SSRManifest) {
if (app.match(request)) {
return app.render(request);
}

// 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 4d8a5ea

Please sign in to comment.