diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js index 005bc46..733dd91 100644 --- a/frontend/src/store/index.js +++ b/frontend/src/store/index.js @@ -293,26 +293,13 @@ const store = createStore({ // Wenn Umgebungsvariable nicht gesetzt ist oder leer, verwende Fallback-Logik if (!daemonUrl || (typeof daemonUrl === 'string' && daemonUrl.trim() === '')) { - // In Produktion: Verwende /ws/ über Nginx-Proxy (Port 443) - if (isProduction) { - const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; - daemonUrl = `${protocol}//${hostname}/ws/`; - console.log('[Daemon] Verwende Nginx-Proxy /ws/ über Port 443'); - } else { - // Lokale Entwicklung: direkte Verbindung zum Daemon-Port 4551 - const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; - daemonUrl = `${protocol}//${hostname}:4551/`; - console.log('[Daemon] Verwende Fallback basierend auf Hostname, Protokoll und Port 4551'); - } + // Immer direkte Verbindung zum Daemon-Port 4551 (verschlüsselt) + const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; + daemonUrl = `${protocol}//${hostname}:4551/`; + console.log('[Daemon] Verwende direkte Verbindung zu Port 4551'); } else { - // Wenn Umgebungsvariable gesetzt ist, aber in Produktion: Konvertiere Port 4551 zu /ws/ - if (isProduction && daemonUrl.includes(':4551')) { - const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; - daemonUrl = `${protocol}//${hostname}/ws/`; - console.log('[Daemon] Konvertiere Port 4551 zu /ws/ für Nginx-Proxy'); - } else { - console.log('[Daemon] Verwende Umgebungsvariable'); - } + // Wenn Umgebungsvariable gesetzt ist, verwende sie direkt + console.log('[Daemon] Verwende Umgebungsvariable:', daemonUrl); } console.log('[Daemon] Finale Daemon-URL:', daemonUrl); diff --git a/yourpart-https.conf b/yourpart-https.conf index 6a418ab..ea76622 100644 --- a/yourpart-https.conf +++ b/yourpart-https.conf @@ -48,19 +48,6 @@ ProxyPass "http://localhost:2020/socket.io/" ProxyPassReverse "http://localhost:2020/socket.io/" - - # Daemon: WebSocket mit Location-Block - - # WebSocket-Upgrade - RewriteEngine on - RewriteCond %{HTTP:Upgrade} websocket [NC] - RewriteCond %{HTTP:Connection} upgrade [NC] - RewriteRule .* "ws://localhost:4551%{REQUEST_URI}" [P,L] - - # HTTP-Fallback - ProxyPass "http://localhost:4551/" - ProxyPassReverse "http://localhost:4551/" - ErrorLog /var/log/apache2/yourpart.error.log CustomLog /var/log/apache2/yourpart.access.log combined diff --git a/yourpart-websocket-fixed.conf b/yourpart-websocket-fixed.conf index 8407b36..8e76ef7 100644 --- a/yourpart-websocket-fixed.conf +++ b/yourpart-websocket-fixed.conf @@ -1,31 +1,38 @@ # /etc/apache2/sites-available/yourpart-websocket.conf + 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 - # HTTP/2 deaktivieren - Protocols http/1.1 - - # WebSocket-Proxy (unverschlüsselt zu Daemon) + # Proxy-Einstellungen ProxyPreserveHost On ProxyRequests Off + AllowEncodedSlashes NoDecode # WebSocket-Upgrade (muss VOR ProxyPass stehen) RewriteEngine On RewriteCond %{HTTP:Upgrade} websocket [NC] RewriteCond %{HTTP:Connection} upgrade [NC] - RewriteRule ^/?(.*) "ws://localhost:4551/$1" [P,L] + RewriteRule ^/?(.*) "ws://localhost:4552/$1" [P,L] # Fallback für normale HTTP-Requests (falls nötig) - ProxyPass / http://localhost:2020/ - ProxyPassReverse / http://localhost:2020/ + ProxyPass / http://localhost:4552/ + ProxyPassReverse / http://localhost:4552/ # 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 + \ No newline at end of file