diff options
Diffstat (limited to 'app.js')
| -rw-r--r-- | app.js | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -59,6 +59,18 @@ class App { app.use(helmet()) app.use(limiter) } + app.use((req, res, next) => { + let err = null + try { + decodeURIComponent(req.path) + } catch(e) { + err = e + } + if (err){ + return res.redirect(['http://', req.get('Host'), '/404'].join('')) + } + next() + }) app.route('*') .get(this.#ValidateCookie, this.#Logger, (req, res) => { @@ -169,6 +181,9 @@ class App { } }) }) + .all((req, res, next) => { + res.send('Other requests called'); + }) app.listen(3000) } |
