Closed ddaydd closed 2 years ago
hello I manage my 404 errors this way.
const { pathToRegexp } = require("path-to-regexp"); Meteor.startup(() => { // Return a 404 HTTP response if the route doesn't exist WebApp.connectHandlers.use("/", function (req, res, next) { let paths = _.uniq(Router.routes.map((route) => route._path)); paths.push("/reset-password/:token"); if (req.url.slice(0, 17) === '/aws-health-check') next(); else { let mainUrl = req.url.split('?')[0]; if (_.find(paths, (path) => pathToRegexp(path).test(mainUrl))) next(); else { dfm.logError({ messages: [`404: ${req.url}`], tag: "404" }); res.writeHead(404, { 'Content-Type': 'text/html' }); const contents = Assets.getText('404.html'); res.end(contents); } } }); });
If I don't add the line that allows the "/aws-health-check" route, the deployment fails, is that normal?
I released version 0.8.0 yesterday which should fix it. Have you tried the new version?
Ah, ok, not tried yet, I will. thank you
I just tried it, it's good. thank you
hello I manage my 404 errors this way.
If I don't add the line that allows the "/aws-health-check" route, the deployment fails, is that normal?