Files
LogWhispererAI/frontend/vite.config.ts
Luca Sacchi Ricciardi 894073644f 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
2026-04-03 18:55:21 +02:00

38 lines
1.1 KiB
TypeScript

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
server: {
host: '0.0.0.0',
port: 5173,
watch: {
usePolling: true,
},
// Allow requests from reverse proxy host
// Add your production domain here
allowedHosts: [
'localhost',
'127.0.0.1',
'.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'],
},
},
})