Serve 404 page with status code 404, not 200

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
Anders Kaseorg 2020-12-21 22:01:18 -08:00
parent 89e242c329
commit 7af708e8ac

View File

@ -89,6 +89,7 @@ module.exports = function(eleventyConfig) {
browserSync.addMiddleware("*", (req, res) => { browserSync.addMiddleware("*", (req, res) => {
// Provides the 404 content without redirect. // Provides the 404 content without redirect.
res.writeHead(404, {"Content-Type": "text/html; charset=UTF-8"});
res.write(content_404); res.write(content_404);
res.end(); res.end();
}); });