How to fix API rate limit (429 Too Many Requests) errors
Why APIs return 429 errors, how to handle them gracefully with backoff and retries, and how to reduce the number of requests your application makes.
What CORS errors actually mean, why they happen, and how to fix them correctly on the server, including preflight requests, credentials and common mistakes.
A CORS error means the browser blocked a web page from reading a response from another origin because the server didn't explicitly allow it. CORS is enforced by browsers and configured on the server. Fix it by having the API return the right Access-Control-Allow-Origin and related headers, handle preflight OPTIONS requests, and list allowed methods and headers. Never fix it by allowing every origin with credentials.
"Access to fetch has been blocked by CORS policy" is one of the most common errors in web development. It's also widely misunderstood. CORS isn't a bug in your front-end code; it's a browser security feature that the server must configure.
Browsers follow the same-origin policy: a page from one origin (a combination of scheme, domain and port) can't freely read responses from another origin. This stops malicious sites from reading your data from other sites where you're logged in.
Cross-Origin Resource Sharing (CORS) lets servers say, "requests from these origins are allowed to read my responses."
For requests that aren't "simple," such as those using methods like PUT or DELETE, custom headers or JSON content types, the browser first sends an OPTIONS "preflight" request asking permission. The server must respond with:
If the server doesn't handle OPTIONS correctly, the real request never happens.
If requests include cookies or authentication headers with credentials mode enabled:
If a third-party API doesn't allow your origin, call it from your own server or serverless function instead of directly from the browser. This also keeps API keys secret, which you should do anyway.
Serving your front end and API from the same origin, for example app.example.com and app.example.com/api, avoids CORS entirely. Many hosting platforms make this easy with rewrites or proxies.
Once CORS is working, you might hit rate limits. Our guide to fixing API rate limit 429 errors covers handling those gracefully.
CORS isn't a security barrier for your server; it protects users' browsers. Your API must still authenticate and authorise every request, because non-browser clients ignore CORS entirely. If requests fail in other ways after CORS is fixed, such as memory or performance problems in the front end, our guide to fixing JavaScript memory leaks covers one common cause.
Our web app development team configures APIs, gateways and CORS securely. Our web development team sets up same-origin routing where it simplifies things, and our app development service designs APIs for web and mobile clients.
No. CORS is enforced by the browser and configured on the server that receives the request.
CORS is a browser security feature. Native mobile apps aren't subject to it, though APIs should still authenticate requests.
Only for genuinely public resources that don't use cookies or credentials. Use specific origins for private APIs.
This guide is general information, not legal, tax or financial advice, and details such as prices, features and rules can change. Product and company names mentioned are trademarks of their respective owners and are used only to identify those products; UK Technology Hub is not affiliated with or endorsed by them.
Tell us about your project and get a free, fixed quote.
Get a free quoteWhy APIs return 429 errors, how to handle them gracefully with backoff and retries, and how to reduce the number of requests your application makes.
Why React hydration mismatches happen in server-rendered apps, how to read the error, and reliable fixes for dates, browser-only code, invalid HTML and extensions.
A calm, step-by-step guide to diagnosing and fixing a blank white WordPress page, from recovery mode and debug logs to plugins, themes and memory limits.