Firefox doesn't display error message if no page content


(Zach) #1

Go to a page that returns no content but returns a status header; for example, in nodejs:

require('http').createServer(function (req, res) {
    res.writeHead(404);
    res.end();
}).listen(80);

When you go to the page in firefox, it just displays a blank page, but if you go to the page in chrome or etc, it displays an error message.


(jscher2000) #2

I don’t run node, but this PHP causes the same:

<?php
http_response_code(404);
die();
?>

https://www.jeffersonscher.com/temp/404.php

It may not be a common situation, but showing the 404 page would be more user-friendly than a blank page.