Skip to content

Commit

Permalink
Add basepath when redirecting from a trailling slash
Browse files Browse the repository at this point in the history
Backports PR #8966

**Commit 1:**
Add basepath when redirecting from a trailling slash

* Original sha: 442bcb9
* Authored by Jonathan Budzenski <jon@jbudz.me> on 2016-11-04T13:33:24Z
  • Loading branch information
elastic-jasper committed Nov 10, 2016
1 parent 4a76abc commit d1e387e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/server/http/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit d1e387e

Please sign in to comment.