From 7f01d76c2b81eddcbaf7ef1549d14bd9b518d58d Mon Sep 17 00:00:00 2001 From: Fork Less Date: Wed, 24 Jun 2026 21:01:31 +0200 Subject: [PATCH] fix: preserve ws:// vs wss:// scheme in URL normalization --- frontend/src/App.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 30bf38c..9fb5e03 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -436,9 +436,13 @@ function App(): JSX.Element { } let rawUrl = import.meta.env.CUSTOM_VITE_WS_URL || 'wss://excalidraw.forkless.com' + let scheme = 'wss://' try { - const parsed = new URL(rawUrl.startsWith('ws') ? rawUrl.replace(/^ws/, 'http') : rawUrl) - rawUrl = 'wss://' + parsed.host + let parseable = rawUrl + if (rawUrl.startsWith('ws://')) { scheme = 'ws://'; parseable = rawUrl.replace(/^ws:\/\//, 'http://') } + else if (rawUrl.startsWith('wss://')) { parseable = rawUrl.replace(/^wss:\/\//, 'https://') } + const parsed = new URL(parseable) + rawUrl = scheme + parsed.host } catch { // Bare hostname/IP — prepend wss:// rawUrl = 'wss://' + rawUrl