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
This commit is contained in:
+7
-7
@@ -100,17 +100,17 @@ function App() {
|
|||||||
|
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
|
||||||
// En mode dev (HTTPS via Vite), utiliser le proxy WebSocket
|
// Si HTTPS, utiliser le proxy WebSocket (résout mixed content)
|
||||||
// En mode prod (HTTP direct), utiliser l'URL LiveKit directement
|
// Sinon utiliser l'URL LiveKit directement
|
||||||
let livekitUrl = data.url;
|
let livekitUrl = data.url;
|
||||||
|
|
||||||
if (import.meta.env.DEV && window.location.protocol === 'https:') {
|
if (window.location.protocol === 'https:') {
|
||||||
// Mode dev avec Vite : utiliser le proxy WSS
|
// HTTPS : utiliser le proxy WSS (wss://host:port/livekit)
|
||||||
livekitUrl = `${window.location.protocol}//${window.location.host}/livekit`;
|
livekitUrl = `wss://${window.location.host}/livekit`;
|
||||||
|
console.log('🔒 Mode HTTPS : utilisation proxy WebSocket');
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('🔗 Connexion LiveKit:', livekitUrl);
|
console.log('🔗 Connexion LiveKit:', livekitUrl);
|
||||||
console.log('📝 Mode:', import.meta.env.DEV ? 'dev' : 'prod');
|
|
||||||
|
|
||||||
// Se connecter à LiveKit avec les canaux virtuels
|
// Se connecter à LiveKit avec les canaux virtuels
|
||||||
await connect(livekitUrl, data.token, data.virtualChannels || []);
|
await connect(livekitUrl, data.token, data.virtualChannels || []);
|
||||||
@@ -154,7 +154,7 @@ function App() {
|
|||||||
// Adapter l'URL LiveKit selon le protocole de la page
|
// Adapter l'URL LiveKit selon le protocole de la page
|
||||||
let livekitUrl = data.url;
|
let livekitUrl = data.url;
|
||||||
if (window.location.protocol === 'https:') {
|
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
|
// Changer de room LiveKit avec les canaux virtuels du nouveau groupe
|
||||||
|
|||||||
Reference in New Issue
Block a user