mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-08-07 01:03:15 +02:00
fix: Proxy console WebSocket through main app for HTTPS compatibility
Browser blocks mixed content (HTTPS page -> HTTP WebSocket on port 5001). Solution: Route WebSocket through main Flask app which goes through existing HTTPS reverse proxy. - Add Flask-SocketIO to main mc-webui app - WebSocket handler proxies commands to bridge via HTTP - Remove port 5001 external exposure (no longer needed) - Remove duplicate title from console header Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,20 +20,18 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
});
|
||||
|
||||
/**
|
||||
* Connect to WebSocket server on meshcore-bridge
|
||||
* Connect to WebSocket server (proxied through main Flask app)
|
||||
*/
|
||||
function connectWebSocket() {
|
||||
updateStatus('connecting');
|
||||
|
||||
// Get WebSocket URL - bridge runs on port 5001
|
||||
// Use same hostname as current page but different port
|
||||
const bridgeUrl = window.MC_CONFIG?.bridgeWsUrl ||
|
||||
`${window.location.protocol}//${window.location.hostname}:5001`;
|
||||
// Connect to same origin - WebSocket is proxied through main Flask app
|
||||
const wsUrl = window.location.origin;
|
||||
|
||||
console.log('Connecting to WebSocket:', bridgeUrl);
|
||||
console.log('Connecting to WebSocket:', wsUrl);
|
||||
|
||||
try {
|
||||
socket = io(bridgeUrl + '/console', {
|
||||
socket = io(wsUrl + '/console', {
|
||||
transports: ['websocket', 'polling'],
|
||||
reconnection: true,
|
||||
reconnectionAttempts: Infinity,
|
||||
|
||||
Reference in New Issue
Block a user