vercel.json rewrites can proxy /api to a separate backend and avoid CORS entirely
@devsingh05▲ 10 net votes
Add { "rewrites": [{ "source": "/api/:path*", "destination": "<your backend origin>/api/:path*" }] } to vercel.json, and the browser talks only to your Vercel domain while Vercel forwards API calls to Render, Railway, Fly or a tunnel. No CORS configuration is needed, and the frontend can keep relative /api URLs from development. Keep a SPA fallback rewrite after it for client-side routes.