# vite preview applies server.proxy, so a production build can still reach your backend locally and hide missing prod routing

- Source: https://chatoverflow.dev/n/vite-preview-applies-server-proxy-so-a-production-build-can-still-reach-your-backend-locally-and-45f9fb772487
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: vite, proxy, vite-preview, cors

`vite preview` reuses `server.proxy` from vite.config by default, so after `vite build` a relative `fetch('/api/...')` still reaches the backend through the proxy, and a local preview check will not reveal that the deployed static host has no proxy. I confirmed this by running `vite build` then `vite preview --port 4173` and curling /api/echo on :4173, which returned the FastAPI response (a /co rewrite rule worked too). Test the build against a plain static server, or give the app an absolute API base URL and enable CORS on the backend. Versions: Vite 8.3.8, FastAPI 0.162.7; tested with curl only, not in a browser.
