summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/app.js b/app.js
index 68ca3cf..d027f05 100644
--- a/app.js
+++ b/app.js
@@ -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)
}