404 page should not be an error, but a full default response

This commit is contained in:
Alex Hultman
2023-12-19 04:38:23 +01:00
parent 97e8099bc2
commit 53e835c1fa
3 changed files with 8 additions and 9 deletions
+6
View File
@@ -216,6 +216,12 @@ public:
TemplatedApp(SocketContextOptions options = {}) {
httpContext = HttpContext<SSL>::create(Loop::get(), options);
/* Register default handler for 404 (can be overridden by user) */
this->any("/*", [](auto *res, auto */*req*/) {
res->writeStatus("404 File Not Found");
res->end("<html><body><h1>File Not Found</h1><hr><i>uWebSockets/20 Server</i></body></html>");
});
}
bool constructorFailed() {