Why does the Swiggy API work in Postman but not in my React app?
Because Postman is not a browser and does not enforce CORS. The browser blocks the response because the server did not grant your origin permission. The request reaches the server fine; the browser just refuses to hand you the response.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in Why the Swiggy API Blocks Localhost and How to Work Around It
Because the API checks the Origin header, and localhost is not in its allowed origins. The server does not return the CORS headers the browser needs, so the browser blocks the response, even though the request actually reached the server.
The cleanest fix is a development proxy. Your bundler or a small backend forwards the request from a server-side origin, avoiding the browser's CORS rules entirely for local development.
Only for quick testing. It disables CORS in your browser, which works for development but is not a real solution and must never be used in production. Use it sparingly and switch to a proxy as soon as possible.
Still have questions?
Browse all our FAQs or reach out to our support team
