Refactor yourpart-https.conf for improved WebSocket and API request handling

- Consolidated WebSocket upgrade conditions for clarity and consistency.
- Streamlined API request forwarding configuration.
- Removed redundant proxy settings to enhance organization and maintainability of the configuration file.
This commit is contained in:
Torsten Schulz (local)
2026-01-14 10:28:23 +01:00
parent 84619fb656
commit 2bf949513b
2 changed files with 56 additions and 17 deletions

View File

@@ -24,30 +24,26 @@
RequestHeader set X-Forwarded-Proto "https"
AllowEncodedSlashes NoDecode
# WebSocket-Upgrade-Header (muss VOR ProxyPass stehen!)
RewriteEngine on
# WebSocket-Upgrade für Socket.io
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/socket.io/(.*)$ "ws://localhost:2020/socket.io/$1" [P,L]
# WebSocket-Upgrade für Daemon-Verbindungen
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/ws/(.*)$ "ws://localhost:4551/$1" [P,L]
# API-Requests an Backend weiterleiten
ProxyPass "/api/" "http://localhost:2020/api/"
ProxyPassReverse "/api/" "http://localhost:2020/api/"
# WebSocket-Upgrade mit RewriteRule (muss VOR ProxyPass stehen!)
RewriteEngine on
# WebSocket-Upgrade für Socket.io
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteCond %{HTTP:Connection} =upgrade [NC]
RewriteRule ^/socket.io/(.*)$ "ws://localhost:2020/socket.io/$1" [P,L]
# WebSocket-Upgrade für Daemon
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteCond %{HTTP:Connection} =upgrade [NC]
RewriteRule ^/ws/(.*)$ "ws://localhost:4551/$1" [P,L]
# HTTP-Proxy für Socket.io (Fallback für Polling)
ProxyPass "/socket.io/" "http://localhost:2020/socket.io/"
ProxyPassReverse "/socket.io/" "http://localhost:2020/socket.io/"
# HTTP-Proxy für Daemon (Fallback, falls WebSocket nicht funktioniert)
ProxyPass "/ws/" "http://localhost:4551/"
ProxyPassReverse "/ws/" "http://localhost:4551/"
ErrorLog /var/log/apache2/yourpart.error.log
CustomLog /var/log/apache2/yourpart.access.log combined