Fix: Apache WebSocket-Proxy für Daemon-Service verbessert

Problem:
- 502 Proxy Error bei WebSocket-Verbindungen zu /ws/
- Apache konnte nicht mit Daemon-Service auf Port 4551 verbinden

Lösung:
- upgrade=websocket Parameter zu ProxyPass hinzugefügt
- Reihenfolge der RewriteRules und ProxyPass optimiert
- WebSocket-Upgrade-Requests werden jetzt korrekt behandelt

Konfiguration:
- RewriteRules für WebSocket-Upgrade vor ProxyPass
- ProxyPass mit upgrade=websocket für /ws/ → ws://localhost:4551/
- Daemon-Service läuft auf Port 4551 und akzeptiert nur WebSocket-Verbindungen
This commit is contained in:
Torsten Schulz (local)
2025-09-04 00:23:55 +02:00
parent 3ebbec557b
commit 5a2fd2d5bd

View File

@@ -26,10 +26,6 @@
ProxyPass "/socket.io/" "http://localhost:2020/socket.io/" ProxyPass "/socket.io/" "http://localhost:2020/socket.io/"
ProxyPassReverse "/socket.io/" "http://localhost:2020/socket.io/" ProxyPassReverse "/socket.io/" "http://localhost:2020/socket.io/"
# WebSocket-Proxy für Daemon-Verbindungen
ProxyPass "/ws/" "ws://localhost:4551/"
ProxyPassReverse "/ws/" "ws://localhost:4551/"
# WebSocket-Upgrade-Header für Socket.io # WebSocket-Upgrade-Header für Socket.io
RewriteEngine on RewriteEngine on
RewriteCond %{HTTP:Upgrade} websocket [NC] RewriteCond %{HTTP:Upgrade} websocket [NC]
@@ -41,6 +37,10 @@
RewriteCond %{HTTP:Connection} upgrade [NC] RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/ws/(.*)$ "ws://localhost:4551/$1" [P,L] RewriteRule ^/ws/(.*)$ "ws://localhost:4551/$1" [P,L]
# WebSocket-Proxy für Daemon-Verbindungen (nur für WebSocket-Upgrade)
ProxyPass "/ws/" "ws://localhost:4551/" upgrade=websocket
ProxyPassReverse "/ws/" "ws://localhost:4551/"
ErrorLog /var/log/apache2/yourpart.error.log ErrorLog /var/log/apache2/yourpart.error.log
CustomLog /var/log/apache2/yourpart.access.log combined CustomLog /var/log/apache2/yourpart.access.log combined