Update Apache configuration to optimize WebSocket handling and enhance security measures

This commit refines the Apache configuration for improved WebSocket support by adjusting the <LocationMatch> directive and ensuring proper upgrade handling. It also updates SSL settings and certificate paths for better security, while enhancing the organization of DocumentRoot and logging paths. These changes bolster the server's capability to manage real-time communication effectively and securely.
This commit is contained in:
Torsten Schulz (local)
2025-11-15 23:24:55 +01:00
parent 5b4a5ba501
commit cb2d7d3936

View File

@@ -0,0 +1,63 @@
#!/usr/bin/env node
/**
* Test-Script zum Prüfen, ob der WebSocket-Server lokal erreichbar ist
*
* Verwendung:
* node scripts/testWebSocket.js
* node scripts/testWebSocket.js localhost 3050
*/
import { io } from 'socket.io-client';
const host = process.argv[2] || 'localhost';
const port = process.argv[3] || '3050';
const url = `http://${host}:${port}`;
console.log(`🔌 Teste WebSocket-Verbindung zu ${url}...`);
const socket = io(url, {
path: '/socket.io/',
transports: ['websocket', 'polling'],
reconnection: false,
timeout: 5000,
});
socket.on('connect', () => {
console.log('✅ WebSocket-Verbindung erfolgreich!');
console.log(` Socket ID: ${socket.id}`);
console.log(` Transport: ${socket.io.engine.transport.name}`);
// Test: Trete einem Club-Raum bei
socket.emit('join-club', 1);
console.log(' Test: join-club Event gesendet');
// Nach 2 Sekunden trennen
setTimeout(() => {
socket.disconnect();
console.log(' Verbindung getrennt.');
process.exit(0);
}, 2000);
});
socket.on('connect_error', (error) => {
console.error('❌ WebSocket-Verbindungsfehler:');
console.error(` ${error.message}`);
if (error.message.includes('ECONNREFUSED')) {
console.error(' → Server läuft möglicherweise nicht oder ist nicht erreichbar');
}
process.exit(1);
});
socket.on('disconnect', (reason) => {
console.log(` Getrennt: ${reason}`);
});
// Timeout nach 10 Sekunden
setTimeout(() => {
if (socket.connected) {
socket.disconnect();
}
console.error('❌ Timeout: Keine Verbindung innerhalb von 10 Sekunden');
process.exit(1);
}, 10000);