fix: return 404 status on not-found SPA fallback (#1061) (#1063)

The non-API branch of setNotFoundHandler served the Next.js index shell
without setting the status code, so clients saw HTTP 200 with a Not-Found
UI. This broke monitoring, ingress proxy_intercept_errors rules,
crawlers, and curl -f. Set status 404 explicitly before serving the
index.

Closes #1061

Co-authored-by: dicedtomato <git@diced.sh>
This commit is contained in:
Tomasz Kołodziej
2026-04-24 08:29:10 +02:00
committed by GitHub
parent 5a58abeb51
commit a0907e8791

View File

@@ -19,6 +19,7 @@ export function registerHandlers(server: FastifyInstance, mode: string) {
statusCode: 404,
});
} else {
res.status(404);
return res.serveIndex();
}
});