From 861448f565efbe9ec310ef1b399a88f67bce3fff Mon Sep 17 00:00:00 2001 From: Benoit Date: Fri, 19 Jun 2026 13:52:47 +0200 Subject: [PATCH] fix: utiliser proxy WSS pour LiveKit en mode HTTPS Correction detection du protocole pour utiliser le bon endpoint LiveKit. Modifications: - client/src/App.jsx: detection HTTPS au lieu de import.meta.env.DEV - Si HTTPS: utiliser wss://host/livekit (proxy) - Si HTTP: utiliser URL LiveKit directe Probleme resolu: - Mixed content error (HTTPS ne peut pas WS) - Fonctionne maintenant en prod HTTPS build --- client/src/App.jsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/client/src/App.jsx b/client/src/App.jsx index 79e226b..3d30831 100644 --- a/client/src/App.jsx +++ b/client/src/App.jsx @@ -100,17 +100,17 @@ function App() { const data = await response.json(); - // En mode dev (HTTPS via Vite), utiliser le proxy WebSocket - // En mode prod (HTTP direct), utiliser l'URL LiveKit directement + // Si HTTPS, utiliser le proxy WebSocket (résout mixed content) + // Sinon utiliser l'URL LiveKit directement let livekitUrl = data.url; - if (import.meta.env.DEV && window.location.protocol === 'https:') { - // Mode dev avec Vite : utiliser le proxy WSS - livekitUrl = `${window.location.protocol}//${window.location.host}/livekit`; + if (window.location.protocol === 'https:') { + // HTTPS : utiliser le proxy WSS (wss://host:port/livekit) + livekitUrl = `wss://${window.location.host}/livekit`; + console.log('🔒 Mode HTTPS : utilisation proxy WebSocket'); } console.log('🔗 Connexion LiveKit:', livekitUrl); - console.log('📝 Mode:', import.meta.env.DEV ? 'dev' : 'prod'); // Se connecter à LiveKit avec les canaux virtuels await connect(livekitUrl, data.token, data.virtualChannels || []); @@ -154,7 +154,7 @@ function App() { // Adapter l'URL LiveKit selon le protocole de la page let livekitUrl = data.url; if (window.location.protocol === 'https:') { - livekitUrl = `${window.location.protocol}//${window.location.host}/livekit`; + livekitUrl = `wss://${window.location.host}/livekit`; } // Changer de room LiveKit avec les canaux virtuels du nouveau groupe