From 894073644f0590ef47950dbc7c3433e33319e030 Mon Sep 17 00:00:00 2001 From: Luca Sacchi Ricciardi Date: Fri, 3 Apr 2026 18:55:21 +0200 Subject: [PATCH] fix: disable HMR in production to fix WebSocket error behind reverse proxy - Disable HMR when NODE_ENV=production to prevent WebSocket binding errors - HMR was trying to bind to external IP:443 which is not available in Docker - App now works correctly behind HTTPS reverse proxy --- frontend/vite.config.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index ec4be6f..0961f6c 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -18,5 +18,20 @@ export default defineConfig({ '.lab.home.lucasacchi.net', // Allow all subdomains 'logwhispererai.lab.home.lucasacchi.net', ], + // HMR configuration - disabled when running behind reverse proxy + // HMR causes issues with WebSocket through HTTPS reverse proxy + hmr: process.env.NODE_ENV === 'production' ? false : { + // Use polling instead of WebSocket for HMR (more compatible with reverse proxy) + protocol: 'wss', + host: 'logwhispererai.lab.home.lucasacchi.net', + port: 443, + clientPort: 443, + }, + // CORS configuration + cors: { + origin: '*', + methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'], + allowedHeaders: ['Content-Type', 'Authorization'], + }, }, })