Plain definition
Definition of Cross-Origin Resource Sharing (CORS)
An HTTP-header protocol that lets a server declare which external web origins a browser may allow client-side scripts to read responses from.
Browser (Origin A) -> OPTIONS Preflight (if non-simple) -> Server (Access-Control-Allow-Origin) -> Actual RequestWorked example
Say a founder ships a made-up embeddable feedback widget called NoteDrop whose web dashboard runs at `https://app.notedrop.example` while its API runs on `https://api.notedrop.example`. Even though both share a root domain, different subdomains count as different origins under the browser's same-origin policy. When dashboard JavaScript calls `fetch("https://api.notedrop.example/v1/boards", { method: "POST", headers: { "Content-Type": "application/json", "Authorization": "Bearer ..." } })`, the browser first sends an `OPTIONS` preflight request asking if `POST` and `Authorization` are permitted from `https://app.notedrop.example`.
The NoteDrop API answers the `OPTIONS` request with `204 No Content`, `Access-Control-Allow-Origin: https://app.notedrop.example`, `Access-Control-Allow-Methods: GET, POST, DELETE`, `Access-Control-Allow-Headers: Content-Type, Authorization`, and `Vary: Origin`. Only then does the browser fire the real `POST` call and expose its JSON response to NoteDrop's frontend code.
Why it matters when you launch
As MDN explains, browsers enforce the same-origin policy on `fetch()` and `XMLHttpRequest` so random tabs cannot silently read your private authenticated responses from another site. Whenever you split your frontend and API across separate domains, serve a Chrome extension, or ship an embeddable widget on customer websites, misconfigured CORS headers will block legitimate requests on launch morning. Knowing the difference between simple requests (such as plain `GET` requests with standard headers) and preflighted `OPTIONS` requests helps you debug failures quickly in browser DevTools.
Two security rules matter just as much as getting requests unblocked. First, never combine `Access-Control-Allow-Credentials: true` with wildcard `*` (browsers reject it, and echoing arbitrary `Origin` headers blindly leaks authenticated data to any attacker site). Second, remember that CORS is strictly a browser boundary: `curl`, Python scripts, and backend servers ignore CORS headers completely, so every endpoint still needs real authentication.
Common mistakes
- Reflecting the incoming `Origin` header verbatim alongside `Access-Control-Allow-Credentials: true`, letting any malicious site read authenticated user data.
- Using `Access-Control-Allow-Origin: *` on endpoints that expect cookies or `Authorization` credentials, causing browser preflight failures.
- Treating CORS rules as API access control while forgetting that command-line tools and server scripts bypass browser CORS checks entirely.
- Forgetting `Vary: Origin` when returning per-origin CORS headers behind a CDN, poisoning cached responses across different calling domains.
Tools and guides that use it
Free tool
Launch Day ChecklistEverything to check before, during and after launch day, saved in your browser.Free tool
Live Launch Readiness CheckerInspect any live URL for HTTPS, title, meta description, canonical, Open Graph cards, JSON-LD and AI search crawler access.Founder guide
How to Launch a Chrome Extension (2026)Get through Chrome Web Store review on the first try, then bring your first users and reviews in from outside the store.Founder guide
The Next.js Technical SEO Launch Checklist (2026)What to check before and after launch day: crawlability, metadata, canonical URLs, structured data, sitemaps, internal links, Core Web Vitals and AI crawlers.Related glossary terms
Official sources
Pritam Ghosh runs Hauntboard and maintains this glossary.
Published · Updated
Building something real? Launch it in public.
A person reviews every launch on Hauntboard, and every view and visit it sends your site is published on your launch page. Free to submit.