Update apache-config-example.conf to enhance WebSocket support and refine reverse proxy configuration for Socket.IO. Added comments for clarity and ensured proper routing for WebSocket connections and polling.

This commit is contained in:
Torsten Schulz (local)
2025-12-05 09:25:57 +01:00
parent 6b0e905d27
commit 7b98f7a5ac

View File

@@ -28,21 +28,31 @@
Require all granted Require all granted
</Location> </Location>
# Rewrite-Regeln für unerwünschte Query-Parameter # Rewrite-Engine für alle Rewrite-Regeln
RewriteEngine On RewriteEngine On
# Rewrite-Regeln für unerwünschte Query-Parameter
RewriteCond %{QUERY_STRING} ^(.*)&?wtd=UrId0B0tLmuMAK9H&?(.*)$ [NC] RewriteCond %{QUERY_STRING} ^(.*)&?wtd=UrId0B0tLmuMAK9H&?(.*)$ [NC]
RewriteRule ^ %{REQUEST_URI}?%1%2 [R=301,L] RewriteRule ^ %{REQUEST_URI}?%1%2 [R=301,L]
# WebSocket-Support für Socket.IO # WebSocket-Support für Socket.IO (muss VOR normalem ProxyPass stehen!)
# Wichtig: Diese Regeln müssen VOR den ProxyPass-Regeln stehen! # Socket.IO verwendet /socket.io/ für Verbindungen
RewriteCond %{HTTP:Upgrade} websocket [NC] RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC] RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/?(.*) "ws://localhost:4000/$1" [P,L] RewriteRule ^/socket\.io/(.*) ws://localhost:4000/socket.io/$1 [P,L]
# Reverse Proxy zu Node.js # Reverse Proxy zu Node.js
# WICHTIG: ProxyPass muss ALLE Routen abfangen, auch / # WICHTIG: ProxyPass muss ALLE Routen abfangen, auch /
ProxyPreserveHost On ProxyPreserveHost On
# ProxyPass für Socket.IO (auch für Polling)
ProxyPass /socket.io/ http://localhost:4000/socket.io/
ProxyPassReverse /socket.io/ http://localhost:4000/socket.io/
# Ausnahme für /ads.txt
ProxyPass /ads.txt ! ProxyPass /ads.txt !
# Alle anderen Anfragen an Node.js
ProxyPass / http://localhost:4000/ ProxyPass / http://localhost:4000/
ProxyPassReverse / http://localhost:4000/ ProxyPassReverse / http://localhost:4000/