Update proxy settings in yourpart-https.conf for improved WebSocket and API handling
- Added ProxyPreserveHost and ProxyRequests directives for better request handling. - Configured WebSocket upgrade headers for Socket.io and daemon connections. - Established HTTP proxies for API and WebSocket requests to ensure fallback mechanisms are in place. - Improved overall clarity and organization of proxy settings in the configuration file.
This commit is contained in:
45
check-apache-websocket.sh
Executable file
45
check-apache-websocket.sh
Executable file
@@ -0,0 +1,45 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "=== Apache WebSocket-Konfiguration prüfen ==="
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Prüfe, welche Module aktiviert sind
|
||||||
|
echo "Aktivierte Apache-Module:"
|
||||||
|
apache2ctl -M 2>/dev/null | grep -E "(proxy|rewrite|ssl|headers)" || echo "Keine relevanten Module gefunden"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Prüfe, ob die benötigten Module aktiviert sind
|
||||||
|
REQUIRED_MODULES=("proxy" "proxy_http" "proxy_wstunnel" "rewrite" "ssl" "headers")
|
||||||
|
MISSING_MODULES=()
|
||||||
|
|
||||||
|
for module in "${REQUIRED_MODULES[@]}"; do
|
||||||
|
if ! apache2ctl -M 2>/dev/null | grep -q "${module}_module"; then
|
||||||
|
MISSING_MODULES+=("$module")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ${#MISSING_MODULES[@]} -eq 0 ]; then
|
||||||
|
echo "✅ Alle benötigten Module sind aktiviert"
|
||||||
|
else
|
||||||
|
echo "❌ Fehlende Module:"
|
||||||
|
for module in "${MISSING_MODULES[@]}"; do
|
||||||
|
echo " - $module"
|
||||||
|
done
|
||||||
|
echo ""
|
||||||
|
echo "Aktivieren mit:"
|
||||||
|
for module in "${MISSING_MODULES[@]}"; do
|
||||||
|
echo " sudo a2enmod $module"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "=== Apache-Konfiguration testen ==="
|
||||||
|
if sudo apache2ctl configtest 2>&1; then
|
||||||
|
echo "✅ Apache-Konfiguration ist gültig"
|
||||||
|
else
|
||||||
|
echo "❌ Apache-Konfiguration hat Fehler"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "=== Aktive VirtualHosts ==="
|
||||||
|
apache2ctl -S 2>/dev/null | grep -E "(443|4443|4551)" || echo "Keine relevanten VirtualHosts gefunden"
|
||||||
@@ -18,28 +18,36 @@
|
|||||||
FallbackResource /index.html
|
FallbackResource /index.html
|
||||||
</Directory>
|
</Directory>
|
||||||
|
|
||||||
# API-Requests an Backend weiterleiten
|
# Proxy-Einstellungen
|
||||||
ProxyPass "/api/" "http://localhost:2020/api/"
|
ProxyPreserveHost On
|
||||||
ProxyPassReverse "/api/" "http://localhost:2020/api/"
|
ProxyRequests Off
|
||||||
|
RequestHeader set X-Forwarded-Proto "https"
|
||||||
|
AllowEncodedSlashes NoDecode
|
||||||
|
|
||||||
# WebSocket-Requests an Backend weiterleiten
|
# WebSocket-Upgrade-Header (muss VOR ProxyPass stehen!)
|
||||||
ProxyPass "/socket.io/" "http://localhost:2020/socket.io/"
|
|
||||||
ProxyPassReverse "/socket.io/" "http://localhost:2020/socket.io/"
|
|
||||||
|
|
||||||
# WebSocket-Upgrade-Header für Socket.io
|
|
||||||
RewriteEngine on
|
RewriteEngine on
|
||||||
|
|
||||||
|
# WebSocket-Upgrade für Socket.io
|
||||||
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]
|
RewriteRule ^/socket.io/(.*)$ "ws://localhost:2020/socket.io/$1" [P,L]
|
||||||
|
|
||||||
# WebSocket-Upgrade-Header für Daemon-Verbindungen
|
# WebSocket-Upgrade für Daemon-Verbindungen
|
||||||
RewriteCond %{HTTP:Upgrade} websocket [NC]
|
RewriteCond %{HTTP:Upgrade} websocket [NC]
|
||||||
RewriteCond %{HTTP:Connection} upgrade [NC]
|
RewriteCond %{HTTP:Connection} upgrade [NC]
|
||||||
RewriteRule ^/ws/(.*)$ "ws://localhost:4551/$1" [P,L]
|
RewriteRule ^/ws/(.*)$ "ws://localhost:4551/$1" [P,L]
|
||||||
|
|
||||||
# WebSocket-Proxy für Daemon-Verbindungen mit benutzerdefiniertem Protokoll
|
# API-Requests an Backend weiterleiten
|
||||||
ProxyPass "/ws/" "ws://localhost:4551/" upgrade=websocket
|
ProxyPass "/api/" "http://localhost:2020/api/"
|
||||||
ProxyPassReverse "/ws/" "ws://localhost:4551/"
|
ProxyPassReverse "/api/" "http://localhost:2020/api/"
|
||||||
|
|
||||||
|
# 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
|
ErrorLog /var/log/apache2/yourpart.error.log
|
||||||
CustomLog /var/log/apache2/yourpart.access.log combined
|
CustomLog /var/log/apache2/yourpart.access.log combined
|
||||||
|
|||||||
Reference in New Issue
Block a user