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