Fix: Apache WebSocket-Proxy für Socket.io korrigiert
Problem: - Socket.io-Verbindungen scheiterten mit NS_ERROR_WEBSOCKET_CONNECTION_REFUSED - Apache hatte keine WebSocket-Upgrade-Header für /socket.io/ konfiguriert Lösung: - WebSocket-Upgrade-Header für /socket.io/ hinzugefügt - RewriteRule für Socket.io WebSocket-Upgrades konfiguriert - Doppelte RewriteEngine on Zeile entfernt Jetzt sollten Socket.io WebSocket-Verbindungen über Apache korrekt an den Backend-Server auf Port 2020 weitergeleitet werden.
This commit is contained in:
@@ -30,10 +30,15 @@
|
|||||||
ProxyPass "/ws/" "ws://localhost:2020/"
|
ProxyPass "/ws/" "ws://localhost:2020/"
|
||||||
ProxyPassReverse "/ws/" "ws://localhost:2020/"
|
ProxyPassReverse "/ws/" "ws://localhost:2020/"
|
||||||
|
|
||||||
# WebSocket-Upgrade-Header
|
# WebSocket-Upgrade-Header für Socket.io
|
||||||
RewriteEngine on
|
RewriteEngine on
|
||||||
RewriteCond %{HTTP:Upgrade} websocket [NC]
|
RewriteCond %{HTTP:Upgrade} websocket [NC]
|
||||||
RewriteCond %{HTTP:Connection} upgrade [NC]
|
RewriteCond %{HTTP:Connection} upgrade [NC]
|
||||||
|
RewriteRule ^/socket.io/(.*)$ "ws://localhost:2020/socket.io/$1" [P,L]
|
||||||
|
|
||||||
|
# WebSocket-Upgrade-Header für Daemon-Verbindungen
|
||||||
|
RewriteCond %{HTTP:Upgrade} websocket [NC]
|
||||||
|
RewriteCond %{HTTP:Connection} upgrade [NC]
|
||||||
RewriteRule ^/ws/(.*)$ "ws://localhost:2020/$1" [P,L]
|
RewriteRule ^/ws/(.*)$ "ws://localhost:2020/$1" [P,L]
|
||||||
|
|
||||||
ErrorLog /var/log/apache2/yourpart.error.log
|
ErrorLog /var/log/apache2/yourpart.error.log
|
||||||
@@ -49,7 +54,6 @@
|
|||||||
SSLCertificateKeyFile /etc/letsencrypt/live/www.your-part.de/privkey.pem
|
SSLCertificateKeyFile /etc/letsencrypt/live/www.your-part.de/privkey.pem
|
||||||
|
|
||||||
# www Redirect
|
# www Redirect
|
||||||
RewriteEngine on
|
|
||||||
RewriteCond %{SERVER_NAME} =your-part.de
|
RewriteCond %{SERVER_NAME} =your-part.de
|
||||||
RewriteRule ^ https://www.%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
|
RewriteRule ^ https://www.%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
|
|||||||
Reference in New Issue
Block a user