Skip to content

Commit

Permalink
[basePathProxy] include query in redirect (#84356)
Browse files Browse the repository at this point in the history
Co-authored-by: spalger <[email protected]>
  • Loading branch information
Spencer and spalger authored Nov 25, 2020
1 parent 71f7786 commit 5c57f3d
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 5c57f3d

Please sign in to comment.