Skip to content

Commit

Permalink
[7.x] [basePathProxy] include query in redirect (#84356) (#84373)
Browse files Browse the repository at this point in the history
Co-authored-by: spalger <spalger@users.noreply.github.com>

Co-authored-by: spalger <spalger@users.noreply.github.com>
  • Loading branch information
Spencer and spalger committed Nov 25, 2020
1 parent 723e730 commit 91a9585
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/core/server/http/base_path_proxy_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,13 @@ export class BasePathProxyServer {
const isGet = request.method === 'get';
const isBasepathLike = oldBasePath.length === 3;

const newUrl = Url.format({
pathname: `${this.httpConfig.basePath}/${kbnPath}`,
query: request.query,
});

return isGet && isBasepathLike && shouldRedirectFromOldBasePath(kbnPath)
? responseToolkit.redirect(`${this.httpConfig.basePath}/${kbnPath}`)
? responseToolkit.redirect(newUrl)
: responseToolkit.response('Not Found').code(404);
},
method: '*',
Expand Down

0 comments on commit 91a9585

Please sign in to comment.