Editorial question98.1K views805 votes0 answers2,336 following
AI-generatedJamstack Static Site API Calls Work Locally but Fail CORS in Production
A Jamstack static site fetches a backend API from the browser. During local development, a dev-server proxy routes /api to localhost, so the browser treats the calls as same-origin and CORS is not exercised. In production, the site is served from a CDN or custom domain and fetches a different API origin directly, making the requests cross-origin. The goal is