Update Apache and backend configuration for direct Socket.IO HTTPS support
This commit modifies the Apache configuration to reflect that Socket.IO now runs directly on HTTPS port 3051, eliminating the need for Apache proxying. Additionally, the backend server setup is updated to create an HTTPS server for Socket.IO, including error handling for SSL certificate loading. The frontend service is also adjusted to connect to the new HTTPS endpoint, ensuring compatibility with the updated architecture.
This commit is contained in:
@@ -11,18 +11,27 @@ export const connectSocket = (clubId) => {
|
||||
}
|
||||
} else {
|
||||
// Neue Verbindung erstellen
|
||||
// Verwende backendBaseUrl direkt, Socket.IO erkennt automatisch den Port
|
||||
socket = io(backendBaseUrl, {
|
||||
// Socket.IO läuft direkt auf HTTPS-Port 3051 (nicht über Apache-Proxy)
|
||||
let socketUrl;
|
||||
if (import.meta.env.PROD) {
|
||||
// Produktion: HTTPS direkt auf Port 3051
|
||||
socketUrl = 'https://tt-tagebuch.de:3051';
|
||||
} else {
|
||||
// Entwicklung: Verwende backendBaseUrl
|
||||
socketUrl = backendBaseUrl;
|
||||
}
|
||||
|
||||
socket = io(socketUrl, {
|
||||
path: '/socket.io/',
|
||||
transports: ['polling', 'websocket'], // Polling zuerst, dann Upgrade zu WebSocket
|
||||
transports: ['websocket', 'polling'], // WebSocket zuerst, dann Fallback zu Polling
|
||||
reconnection: true,
|
||||
reconnectionDelay: 1000,
|
||||
reconnectionAttempts: 5,
|
||||
timeout: 20000,
|
||||
// Erlaube Upgrade von polling zu websocket
|
||||
upgrade: true,
|
||||
// Force new connection
|
||||
forceNew: false
|
||||
forceNew: false,
|
||||
secure: true, // Wichtig für HTTPS
|
||||
rejectUnauthorized: false // Für selbst-signierte Zertifikate (nur Entwicklung)
|
||||
});
|
||||
|
||||
socket.on('connect', () => {
|
||||
|
||||
Reference in New Issue
Block a user