Enhance Apache configuration for WebSocket handling by preserving query strings

This commit updates the Apache configuration to ensure that the query string is retained during WebSocket connections. The RewriteRule for the WebSocket upgrade has been modified to include the QSA flag, improving compatibility for applications relying on query parameters. These changes further optimize the server's handling of real-time communication.
This commit is contained in:
Torsten Schulz (local)
2025-11-15 23:54:12 +01:00
parent 44dba70aac
commit f4e5cf2edb

View File

@@ -37,12 +37,12 @@
# WebSocket-Upgrade erkennen und weiterleiten (wss:// -> ws://)
# Die RewriteRule wird nur ausgeführt, wenn Upgrade-Header vorhanden ist
# Andernfalls wird ProxyPass verwendet (für HTTP-Polling)
# WICHTIG: Query-String muss erhalten bleiben (QSA Flag)
<LocationMatch "^/socket\.io/">
RewriteEngine on
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/?(.*) ws://localhost:3050/$1 [P,L]
RewriteRule ^/socket\.io/?(.*) ws://localhost:3050/socket.io/$1 [P,L,QSA]
# Fallback für HTTP-Polling (wird verwendet, wenn RewriteRule nicht greift)
ProxyPass http://localhost:3050/socket.io/