SecureStartKit
SecurityFeaturesPricingDocsBlogChangelog
Sign inBuy Now
Home/Glossary/CORS
Application Security

CORS(Cross-Origin Resource Sharing)

Also known as: Cross-Origin Resource Sharing, CORS headers

Definition

CORS (Cross-Origin Resource Sharing) is the browser mechanism that controls which origins can call which API endpoints. The server declares allowed origins via Access-Control-Allow-Origin headers, and the browser blocks cross-origin requests that fail the check.

What is CORS?

By default, browsers block JavaScript on https://attacker.com from reading responses to fetches against https://yourapi.com. CORS is the protocol that lets your server explicitly opt in: respond with Access-Control-Allow-Origin: https://yourapp.com and the browser allows the response through.

What is the wildcard CORS anti-pattern?

Access-Control-Allow-Origin: * combined with Access-Control-Allow-Credentials: true is forbidden by the spec, but partial misconfigurations are common: allowing wildcard origins for endpoints that read authenticated session data effectively turns the cookie-credential boundary off. Always pin allowed origins to your known domains.

How does CORS relate to CSRF?

CORS is about JavaScript reading the response. CSRF is about the request happening at all with the user's cookies attached. The browser sends cookies to the target origin regardless of where the request originated. CORS does not block the request from happening; SameSite cookie attributes and CSRF tokens are the defenses for that side of the problem.

Learn more

  • Free CORS Config Generator
  • Next.js Security Hardening Checklist

Related terms

  • CSPCSP (Content Security Policy) is an HTTP response header that tells the browser which sources of scripts, styles, images, and other resources are allowed to load on a page. A well-configured CSP blocks injected scripts even if an XSS vulnerability exists in the application code.
  • CSRFCSRF (Cross-Site Request Forgery) is an attack where a malicious site causes the victim's browser to send a request to a target site using the victim's existing session cookies. In Next.js App Router, Server Actions defend against CSRF by checking the Origin header against the Host on every POST.
← Back to full glossary
SecureStartKit

The security-first Next.js SaaS template. Auth, payments, and everything you need to launch - with backend-only data access, Zod validation on every input, and built-in optimization for AI coding agents.

Summarize with AI

Product

  • Security
  • Features
  • Pricing
  • FAQ
  • Docs
  • About

Use Cases

  • For Indie Hackers
  • For Solo Developers
  • Fintech SaaS
  • Internal Tools
  • Healthtech SaaS

Free Tools

  • All Tools
  • RLS Policy Generator
  • Security Checklist
  • Security Headers
  • JWT Decoder
  • JWT Generator
  • CORS Config Generator
  • JSON to Zod Converter
  • API Key Generator
  • Stripe Webhook Verifier
  • Stripe Fee Calculator
  • SaaS Pricing Calculator
  • Tech Stack Costs
  • OG Image Preview

Compare

  • All comparisons
  • vs ShipFast
  • vs Makerkit
  • vs Supastarter
  • vs Divjoy
  • vs Nextbase
  • One-time vs subscription

Resources

  • Blog
  • Glossary
  • Security Patterns
  • Changelog
  • Contact
  • Privacy
  • Terms

More from the same maker

  • AppScreenshotStudio
  • QueryScope
  • FrictionScope
  • MCP Hunter
  • BookIllustrationAI
  • MyCVCraft
  • StyleMyFade

© 2026 SecureStartKit. All rights reserved.

Built with SecureStartKit