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
This commit is contained in:
Luca Sacchi Ricciardi
2026-04-03 18:55:21 +02:00
parent 26879acba4
commit 894073644f

View File

@@ -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'],
},
},
})