From 8882ff589212ccf0c910dbc1aed1414242099eb7 Mon Sep 17 00:00:00 2001 From: Benoit Date: Wed, 27 May 2026 22:42:18 +0200 Subject: [PATCH] fix: mode dev avec proxy WebSocket, mode prod avec HTTP direct MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Mode dev : proxy Vite /livekit → ws://localhost:7880 (évite mixed content) - Mode prod : HTTP direct, pas de HTTPS (auto-hébergé local) - Détection automatique du mode via import.meta.env.DEV - En production réelle, HTTPS sera géré par reverse proxy --- client/src/App.jsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/client/src/App.jsx b/client/src/App.jsx index 725fc1f..79e226b 100644 --- a/client/src/App.jsx +++ b/client/src/App.jsx @@ -100,11 +100,17 @@ function App() { const data = await response.json(); - // Utiliser directement l'URL LiveKit fournie par le serveur - const livekitUrl = data.url; + // En mode dev (HTTPS via Vite), utiliser le proxy WebSocket + // En mode prod (HTTP direct), 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`; + } console.log('🔗 Connexion LiveKit:', livekitUrl); - console.log('📝 Token:', data.token.substring(0, 50) + '...'); + console.log('📝 Mode:', import.meta.env.DEV ? 'dev' : 'prod'); // Se connecter à LiveKit avec les canaux virtuels await connect(livekitUrl, data.token, data.virtualChannels || []);