π OpenHands: AI-Driven Development
fix protocol: use https when possible (#4303)
Robert Brennanae6c489423e4
diff --git a/frontend/src/api/open-hands.ts b/frontend/src/api/open-hands.tsindex 0d1c2e21df..586c6aaf31 100644--- a/frontend/src/api/open-hands.ts+++ b/frontend/src/api/open-hands.ts@@ -16,7 +16,10 @@ const generateBaseURL = () => {const fallback = getValidFallbackHost();const baseUrl = import.meta.env.VITE_BACKEND_BASE_URL || fallback;- return `http://${baseUrl}`;+ if (typeof window === "undefined") {+ return `http://${baseUrl}`;+ }+ return `${window.location.protocol}//${baseUrl}`;};/**diff --git a/frontend/src/context/socket.tsx b/frontend/src/context/socket.tsxindex 8c820cca57..de6c69ae9f 100644--- a/frontend/src/context/socket.tsx+++ b/frontend/src/context/socket.tsx@@ -48,8 +48,9 @@ function SocketProvider({ children }: SocketProviderProps) {const fallback = getValidFallbackHost();const baseUrl = import.meta.env.VITE_BACKEND_BASE_URL || fallback;+ const protocol = window.location.protocol === "https:" ? "wss:" : "ws:";const ws = new WebSocket(- `ws://${baseUrl}/ws${options?.token ? `?token=${options.token}` : ""}`,+ `${protocol}//${baseUrl}/ws${options?.token ? `?token=${options.token}` : ""}`,);ws.addEventListener("open", (event) => {