Add basepath when redirecting from a trailling slash (#8966)

This commit is contained in:
Jonathan Budzenski 2016-11-10 13:53:45 -06:00 committed by GitHub
parent 60e62c7ad2
commit 62368435ed

View file

@ -103,10 +103,10 @@ module.exports = async function (kbnServer, server, config) {
if (path === '/' || path.charAt(path.length - 1) !== '/') {
return reply(Boom.notFound());
}
const pathPrefix = config.get('server.basePath') ? `${config.get('server.basePath')}/` : '';
return reply.redirect(format({
search: req.url.search,
pathname: path.slice(0, -1),
pathname: pathPrefix + path.slice(0, -1),
}))
.permanent(true);
}