From 9f3b78118ac0192a6c53f8198dc27751f0251847 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 7 Aug 2020 11:30:47 -0400 Subject: [PATCH] fix: send hard 404 instead of soft 404 for missing modules 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 --- src/controllers/404.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controllers/404.js b/src/controllers/404.js index 3e93c4ac32..eb9f94c8d8 100644 --- a/src/controllers/404.js +++ b/src/controllers/404.js @@ -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);