Skip to content

Commit

Permalink
fix(#7301): load 404 page in dev server when returning 404 status code
Browse files Browse the repository at this point in the history
  • Loading branch information
natemoo-re committed Jul 17, 2023
1 parent 6ad4672 commit 60c8165
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/astro/src/vite-plugin-astro-server/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,21 @@ export async function handleRoute({
}
} else {
const result = await renderPage(options);
if (result.status === 404) {
const fourOhFourRoute = await matchRoute('/404', env, manifestData);
return handleRoute({
matchedRoute: fourOhFourRoute,
url: new URL('/404', url),
pathname: '/404',
body,
origin,
env,
manifestData,
incomingRequest,
incomingResponse,
manifest,
});
}
throwIfRedirectNotAllowed(result, config);
return await writeSSRResult(request, result, incomingResponse);
}
Expand Down

0 comments on commit 60c8165

Please sign in to comment.