Skip to content

Commit

Permalink
fix: send hard 404 instead of soft 404 for missing modules
Browse files Browse the repository at this point in the history
We used to send a soft 404 because require.js would error out on
a 404, but it seems years ago, error handling was added to the
require() call, so a hard 404 will not throw errors to the console
  • Loading branch information
julianlam committed Aug 7, 2020
1 parent 8032c8b commit 9f3b781
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/controllers/404.js
Expand Up @@ -21,7 +21,7 @@ exports.handle404 = function handle404(req, res) {
}

if (isClientScript.test(req.url)) {
res.type('text/javascript').status(200).send('');
res.type('text/javascript').status(404).send('Not Found');
} else if (req.path.startsWith(relativePath + '/assets/uploads') || (req.get('accept') && !req.get('accept').includes('text/html')) || req.path === '/favicon.ico') {
meta.errors.log404(req.path || '');
res.sendStatus(404);
Expand Down

0 comments on commit 9f3b781

Please sign in to comment.