import { sveltekit } from '@sveltejs/kit/vite'; import { defineConfig } from 'vite'; // The browser calls same-origin /cms/* on :5173; Vite proxies to the PiCloud // backend on :8081. This sidesteps PiCloud's lack of CORS (FINDINGS F-030) and // avoids CORS preflight entirely (the request is same-origin to the browser). export default defineConfig({ plugins: [sveltekit()], server: { port: 5173, proxy: { '/cms': { target: 'http://localhost:8081', changeOrigin: true }, // SSE realtime stream (live comments) '/realtime': { target: 'http://localhost:8081', changeOrigin: true } } } });