-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
node ssr dont showing 404 page #5535
Comments
mark |
@wulinsheng123 Yes I think that's intentional for dev only if the user doesn't provide a custom 404 page. For production, it should default to what the server would respond for 404. Looking into the issue, looks like this is because we don't pass I think the fix here is that, if we're building for |
Thanks for your tips. |
Fixed in #5701 |
@bluwy Well, the problem was only half fixed. The 404 handler is missing in the middleware module exports. We can work around this in our case by building for |
could you give a minimal duplicated rep ? |
It's possible 298dbb8 may have broken this again? (or that commit fixes this in a future Astro version?) |
@romannurik Some of the issues introduced by #7754 (released in astro v2.9.7) were fixed recently. Please check with the latest version and if it's still there check the feat: 404 label to see if an issue for the bug is already open. |
Thanks! Looks like I'm hitting this already reported issue, so I'll subscribe to updates there: #7881 EDIT: I actually think I'm hitting this one? Essentially my 404.astro, with prerender = false (in output=hybrid), using the node integration in middleware mode, renders the 404 in dev but not in prod |
FWIW, this horrid hack DOES work for me: app.use(astroSsrHandler);
app.use((req, res, next) => {
// only called if astroSsrHandler didn't handle this request originally
req.url = '/404';
astroSsrHandler(req, res, next);
}); So in my situation (see comment above), before this hack, visiting |
What version of
astro
are you using?1.6.12
Are you using an SSR adapter? If so, which one?
node
What package manager are you using?
npm
What operating system are you using?
Windows (but linux have same behavior)
Describe the Bug
This behavior is similar on standalone and middleware mode. When using vite dev server - all ok, default or custom 404 page are showing. But when using build Instead of 404 page - plain text are showing.
run "npm run serve" for starting server in production (build) mode
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-cddzmd
Participation
The text was updated successfully, but these errors were encountered: