fix(web-client): use base URL when switching sessions (#4981)

* fix(web-client): use base URL when switching sessions

Session switch redirected to /{session_name} instead of
{base_url}/{session_name}, breaking reverse proxy setups.

Use getBaseUrl() to construct the redirect URL, consistent with
how auth.js and connection.js already handle base URL.

Fixes #4980

Co-authored-by: Copilot <[email protected]>

* fix(web-client): encode session name in redirect URL

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

* docs: update changelog
---------

Co-authored-by: Copilot <[email protected]>
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
Co-authored-by: Thomas Linford <[email protected]>
This commit is contained in:
TMY
2026-04-02 12:05:51 +02:00
committed by GitHub
co-authored by Copilot Claude Opus 4.6 Thomas Linford
parent 1411b2d9ad
commit 0532949bbd
2 changed files with 4 additions and 2 deletions
+1
View File
@@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
* fix: remote attach issues on macOS (https://github.com/zellij-org/zellij/pull/4972)
* test: improve e2e test reliability and local macOS dev support (https://github.com/zellij-org/zellij/pull/4952)
* fix: preserve background color in trailing and skipped characters (https://github.com/zellij-org/zellij/pull/4992)
* fix: make web client use base URL when switching sessions (https://github.com/zellij-org/zellij/pull/4981)
## [0.44.0] - 2026-03-23
* fix: meta key handling in web client (https://github.com/zellij-org/zellij/pull/4376)
+3 -2
View File
@@ -3,7 +3,7 @@
*/
import { handleReconnection, handleDisconnected, markConnectionEstablished } from "./connection.js";
import { getWebSocketBaseUrl } from "./utils.js";
import { getBaseUrl, getWebSocketBaseUrl } from "./utils.js";
/**
* Initialize both terminal and control WebSocket connections
@@ -241,7 +241,8 @@ function startWsControl(wsControl, term, fitAddon, ownWebClientId, userConfig) {
}
} else if (msg.type === "SwitchedSession") {
const { new_session_name } = msg;
window.location.pathname = `/${new_session_name}`;
const baseUrl = getBaseUrl();
window.location.href = `${baseUrl}/${encodeURIComponent(new_session_name)}`;
}
};