Push WesocketChanges

This commit is contained in:
2025-09-03 17:33:36 +02:00
parent 1a377517a6
commit 915ed53b42
2 changed files with 60 additions and 4 deletions

View File

@@ -19,14 +19,25 @@
# Wichtig für Kamera-Zugriff
Header always set Permissions-Policy "camera=self, microphone=()"
# Reverse Proxy zu Node.js
# WebSocket Support - MUSS vor dem generellen Proxy stehen
RewriteEngine On
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/?(.*) "ws://localhost:3000/$1" [P,L]
# Socket.IO spezifische WebSocket-Routen
ProxyPass /socket.io/ ws://localhost:3000/socket.io/
ProxyPassReverse /socket.io/ ws://localhost:3000/socket.io/
# Standard HTTP/HTTPS Reverse Proxy zu Node.js
ProxyPreserveHost On
ProxyPass /socket.io/ !
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
# WebSocket Support für Live-Updates
ProxyPass /socket.io/ ws://localhost:3000/socket.io/
ProxyPassReverse /socket.io/ ws://localhost:3000/socket.io/
# WebSocket Proxy-Einstellungen
ProxyTimeout 3600
ProxyBadHeader Ignore
# Logging
ErrorLog ${APACHE_LOG_DIR}/ninjaserver_ssl_error.log

45
websocket-setup-commands.sh Executable file
View File

@@ -0,0 +1,45 @@
#!/bin/bash
echo "🔧 Apache WebSocket Support Setup"
echo "================================="
# Kopiere die aktualisierte Apache-Konfiguration
echo "Kopiere Apache-Konfiguration..."
sudo cp /root/ninjaserver/apache-ssl-config.conf /etc/apache2/sites-available/ninjaserver-ssl.conf
echo "✅ Konfiguration kopiert"
# Apache Module aktivieren
echo "Aktiviere benötigte Apache-Module..."
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod proxy_wstunnel
sudo a2enmod rewrite
sudo a2enmod headers
sudo a2enmod ssl
echo "✅ Module aktiviert"
# SSL Site aktivieren (falls noch nicht geschehen)
echo "Aktiviere SSL-Site..."
sudo a2ensite ninjaserver-ssl
# Standard-Site deaktivieren (optional)
echo "Deaktiviere Standard-Site..."
sudo a2dissite 000-default
# Apache-Konfiguration testen
echo "Teste Apache-Konfiguration..."
sudo apache2ctl configtest
if [ $? -eq 0 ]; then
echo "✅ Apache-Konfiguration ist gültig"
echo "Starte Apache neu..."
sudo systemctl restart apache2
echo "✅ Apache wurde neugestartet"
echo ""
echo "🎉 WebSocket Support sollte jetzt funktionieren!"
echo "Teste die Verbindung mit: wss://ninja.reptilfpv.de/socket.io/"
else
echo "❌ Apache-Konfiguration hat Fehler - bitte überprüfen"
fi