Files
yourpart3/yourpart-websocket-fixed.conf
Torsten Schulz (local) 9e845843d8 Update WebSocket and API configurations in yourpart-websocket-fixed.conf and daemonServer.js
- Adjusted WebSocket proxy settings in yourpart-websocket-fixed.conf to route traffic through port 4551 for both secure and non-secure connections.
- Enhanced daemonServer.js to listen on all interfaces (0.0.0.0) for both TLS and non-TLS WebSocket connections, improving accessibility.
2026-01-14 13:10:33 +01:00

39 lines
1.5 KiB
Plaintext

# /etc/apache2/sites-available/yourpart-websocket.conf
<IfModule mod_ssl.c>
<VirtualHost *:4551>
ServerName www.your-part.de
# SSL aktivieren
SSLEngine on
Protocols http/1.1
# SSL-Konfiguration
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/www.your-part.de/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.your-part.de/privkey.pem
# Proxy-Einstellungen
ProxyPreserveHost On
ProxyRequests Off
AllowEncodedSlashes NoDecode
# WebSocket-Upgrade (muss VOR ProxyPass stehen)
# Apache lauscht auf Port 4551 (extern, verschlüsselt) und leitet an Daemon auf Port 4551 weiter (intern, unverschlüsselt)
RewriteEngine On
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/?(.*) "ws://localhost:4551/$1" [P,L]
# Fallback für normale HTTP-Requests (falls nötig)
ProxyPass / http://localhost:4551/
ProxyPassReverse / http://localhost:4551/
# CORS-Headers
Header always set Access-Control-Allow-Origin "https://www.your-part.de"
Header always set Access-Control-Allow-Methods "GET, POST, OPTIONS"
Header always set Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept, Authorization"
ErrorLog /var/log/apache2/yourpart-websocket.error.log
CustomLog /var/log/apache2/yourpart-websocket.access.log combined
</VirtualHost>
</IfModule>