diff --git a/client/vite.config.ts b/client/vite.config.ts index c1e650b..60635be 100644 --- a/client/vite.config.ts +++ b/client/vite.config.ts @@ -32,8 +32,22 @@ export default defineConfig({ port: 5173, proxy: { '/api': serverTarget, - '/admin': serverTarget, '/healthz': serverTarget, + // NOT a bare '/admin' prefix: that would also swallow the /admin and + // /admin.html *page* requests themselves (and, since Vite's proxy + // matches by string prefix, they do — '/admin' matches '/admin.html' + // too), forwarding them to the backend instead of letting Vite serve + // its own dev-mode admin.html. In dev the backend only has a stale + // production build to fall back on (or nothing, if `client` was never + // built), so the page ends up loaded with hashed prod asset paths that + // don't exist in Vite's dev module graph — Vite's dev server then + // answers those with its SPA-fallback HTML instead of JS, which is + // exactly the "wrong MIME type" / NS_ERROR_CORRUPTED_CONTENT failure + // reported for the admin page. Only the backend-owned endpoints need + // to cross the proxy. + '/admin/api': serverTarget, + '/admin/login': serverTarget, + '/admin/logout': serverTarget, }, }, });