diff --git a/ui/client-app/src/services/websocket.js b/ui/client-app/src/services/websocket.js index 75a9067..8cf9a0f 100644 --- a/ui/client-app/src/services/websocket.js +++ b/ui/client-app/src/services/websocket.js @@ -68,8 +68,8 @@ // Correct the WebSocket URL based on the API_BASE_URL protocol. // Use `wss` for `https` and `ws` for `http`. - const url = new URL(API_BASE_URL); - const wsProtocol = url.protocol === "https:" ? "wss" : "ws"; + const url = new URL(API_BASE_URL, window.location.origin); + const wsProtocol = window.location.protocol === "https:" ? "wss" : "ws"; let pathname = url.pathname; // Check if the pathname is just a single slash, if so, don't append it to avoid a double slash