Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/init/router/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func Proxy() gin.HandlerFunc {
return
}

if c.Request.URL.Path == "/api/v2/hosts/terminal" {
if c.Request.URL.Path == "/api/v2/hosts/terminal" && (currentNode == "local" || len(currentNode) == 0) {
proxyLocalAgent(c)
return
}
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/components/terminal/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,9 @@ const initWebSocket = (endpoint_: string, args: string = '') => {
const protocol = href.split('//')[0] === 'http:' ? 'ws' : 'wss';
const host = href.split('//')[1].split('/')[0];
const endpoint = endpoint_.replace(/^\/+/, '');
let conn = `${protocol}://${host}/${endpoint}?cols=${term.value.cols}&rows=${term.value.rows}&${args}&operateNode=${globalStore.currentNode}`;
if (args.indexOf('&operateNode=') !== -1) {
let node = args.indexOf('id=') !== -1 ? 'local' : globalStore.currentNode;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Narrow host-terminal detection to exact id query key

Using args.indexOf('id=') treats any parameter containing that substring as a host-terminal session and forces operateNode=local. This now misroutes non-host terminals such as container exec requests that use containerid=... (for example in frontend/src/views/website/runtime/components/terminal.vue and frontend/src/components/terminal/database.vue), so in multi-node deployments those WebSocket sessions are sent to the local node instead of the active node unless each caller manually adds operateNode. Please match the standalone id key (e.g., query parsing or a stricter pattern) rather than a raw substring.

Useful? React with 👍 / 👎.

let conn = `${protocol}://${host}/${endpoint}?cols=${term.value.cols}&rows=${term.value.rows}&${args}&operateNode=${node}`;
if (args.indexOf('operateNode=') !== -1) {
conn = `${protocol}://${host}/${endpoint}?cols=${term.value.cols}&rows=${term.value.rows}&${args}`;
}
terminalSocket.value = new WebSocket(conn);
Expand Down
Loading