diff --git a/frontend/.env.server b/frontend/.env.server index e5a0c70..b6b5b8e 100644 --- a/frontend/.env.server +++ b/frontend/.env.server @@ -1,5 +1,5 @@ VITE_API_BASE_URL=https://www.your-part.de VITE_TINYMCE_API_KEY=xjqnfymt2wd5q95onkkwgblzexams6l6naqjs01x72ftzryg -VITE_DAEMON_SOCKET=wss://www.your-part.de:2020 -VITE_CHAT_WS_URL=wss://www.your-part.de:1235 +VITE_DAEMON_SOCKET=wss://www.your-part.de/ws +VITE_CHAT_WS_URL=wss://www.your-part.de/ws diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js index 643da6e..fdfc191 100644 --- a/frontend/src/store/index.js +++ b/frontend/src/store/index.js @@ -85,8 +85,8 @@ const store = createStore({ if (currentSocket) { currentSocket.disconnect(); } - console.log('πŸ”Œ Initializing Socket.io connection to:', import.meta.env.VITE_DAEMON_SOCKET); - const socket = io(import.meta.env.VITE_DAEMON_SOCKET, { + console.log('πŸ”Œ Initializing Socket.io connection to:', import.meta.env.VITE_API_BASE_URL); + const socket = io(import.meta.env.VITE_API_BASE_URL, { secure: true, transports: ['websocket', 'polling'] }); @@ -103,7 +103,7 @@ const store = createStore({ socket.on('connect_error', (error) => { console.error('❌ Socket.io connection error:', error); - console.error('❌ URL attempted:', import.meta.env.VITE_DAEMON_SOCKET); + console.error('❌ URL attempted:', import.meta.env.VITE_API_BASE_URL); }); commit('setSocket', socket); diff --git a/yourpart-https.conf b/yourpart-https.conf index afb62d3..17a56cc 100644 --- a/yourpart-https.conf +++ b/yourpart-https.conf @@ -25,6 +25,16 @@ # WebSocket-Requests an Backend weiterleiten ProxyPass "/socket.io/" "http://localhost:2020/socket.io/" ProxyPassReverse "/socket.io/" "http://localhost:2020/socket.io/" + + # WebSocket-Proxy fΓΌr Daemon-Verbindungen + ProxyPass "/ws/" "ws://localhost:2020/" + ProxyPassReverse "/ws/" "ws://localhost:2020/" + + # WebSocket-Upgrade-Header + RewriteEngine on + RewriteCond %{HTTP:Upgrade} websocket [NC] + RewriteCond %{HTTP:Connection} upgrade [NC] + RewriteRule ^/ws/(.*)$ "ws://localhost:2020/$1" [P,L] ErrorLog /var/log/apache2/yourpart.error.log CustomLog /var/log/apache2/yourpart.access.log combined