diff --git a/x-pack/legacy/plugins/security/public/services/auto_logout.js b/x-pack/legacy/plugins/security/public/services/auto_logout.js index eb00d62d0266ca..bb23a611412792 100644 --- a/x-pack/legacy/plugins/security/public/services/auto_logout.js +++ b/x-pack/legacy/plugins/security/public/services/auto_logout.js @@ -10,7 +10,7 @@ import chrome from 'ui/chrome'; const module = uiModules.get('security'); module.service('autoLogout', ($window, Promise) => { return () => { - const next = chrome.removeBasePath(`${window.location.pathname}${window.location.hash}`); + const next = `${window.location.pathname}${window.location.search}${window.location.hash}`; $window.location.href = chrome.addBasePath( `/logout?next=${encodeURIComponent(next)}&msg=SESSION_EXPIRED` ); diff --git a/x-pack/plugins/security/public/session/session_expired.test.ts b/x-pack/plugins/security/public/session/session_expired.test.ts index 678c397dfbc64d..55f37feedd6caa 100644 --- a/x-pack/plugins/security/public/session/session_expired.test.ts +++ b/x-pack/plugins/security/public/session/session_expired.test.ts @@ -80,7 +80,7 @@ describe('Session Expiration', () => { const url = await newUrlPromise; expect(url).toBe( - `/foo/logout?next=${encodeURIComponent('/bar?baz=quz#quuz')}&msg=SESSION_EXPIRED` + `/foo/logout?next=${encodeURIComponent('/foo/bar?baz=quz#quuz')}&msg=SESSION_EXPIRED` ); }); }); diff --git a/x-pack/plugins/security/public/session/session_expired.ts b/x-pack/plugins/security/public/session/session_expired.ts index a43da855267570..3b56b0bfd28c7e 100644 --- a/x-pack/plugins/security/public/session/session_expired.ts +++ b/x-pack/plugins/security/public/session/session_expired.ts @@ -14,9 +14,7 @@ export class SessionExpired { constructor(private basePath: HttpSetup['basePath'], private tenant: string) {} logout() { - const next = this.basePath.remove( - `${window.location.pathname}${window.location.search}${window.location.hash}` - ); + const next = `${window.location.pathname}${window.location.search}${window.location.hash}`; const key = `${this.tenant}/session_provider`; const providerName = sessionStorage.getItem(key); const provider = providerName ? `&provider=${encodeURIComponent(providerName)}` : '';