Refine Apache configuration for WebSocket upgrade handling and clarify conditions
This commit updates the Apache configuration to enhance the handling of WebSocket upgrades by specifying exact conditions for the Upgrade and Connection headers. It also clarifies the fallback mechanism for HTTP polling, ensuring better compatibility and reliability in real-time communication scenarios.
This commit is contained in:
@@ -37,11 +37,11 @@
|
||||
|
||||
# WebSocket-Upgrade erkennen und weiterleiten (wss:// -> ws://)
|
||||
# Die RewriteRule wird nur ausgeführt, wenn Upgrade-Header vorhanden ist
|
||||
# WICHTIG: Query-String muss erhalten bleiben (QSA Flag)
|
||||
# Andernfalls wird ProxyPass verwendet (für HTTP-Polling)
|
||||
<LocationMatch "^/socket\.io/">
|
||||
RewriteEngine on
|
||||
RewriteCond %{HTTP:Upgrade} websocket [NC]
|
||||
RewriteCond %{HTTP:Connection} upgrade [NC]
|
||||
RewriteCond %{HTTP:Upgrade} =websocket [NC]
|
||||
RewriteCond %{HTTP:Connection} =upgrade [NC]
|
||||
RewriteRule ^/socket\.io/?(.*) ws://localhost:3050/socket.io/$1 [P,L,QSA]
|
||||
|
||||
# Fallback für HTTP-Polling (wird verwendet, wenn RewriteRule nicht greift)
|
||||
|
||||
Reference in New Issue
Block a user