mirror of https://github.com/status-im/codimd.git
Update to redirect url with trailing slashes
This commit is contained in:
parent
f6a995143d
commit
f7b719b210
11
app.js
11
app.js
|
@ -149,6 +149,17 @@ passport.deserializeUser(function (id, done) {
|
|||
});
|
||||
});
|
||||
|
||||
// redirect url with trailing slashes
|
||||
app.use(function(req, res, next) {
|
||||
if ("GET" == req.method && req.path.substr(-1) == '/' && req.path.length > 1) {
|
||||
var query = req.url.slice(req.path.length);
|
||||
console.log(config.serverurl + req.path.slice(0, -1) + query);
|
||||
res.redirect(301, config.serverurl + req.path.slice(0, -1) + query);
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
});
|
||||
|
||||
// routes need sessions
|
||||
//template files
|
||||
app.set('views', __dirname + '/public');
|
||||
|
|
Loading…
Reference in New Issue