Skip to content
/
Suscribirse Subscribe

Detrás del telón hay sistemas, no magia. Arquitectura de software, IA y computación de bajo nivel para las trincheras de producción.

Behind the curtain there are systems, not magic. Software architecture, AI, and systems engineering from the production trenches.

🇪🇸 Cambiar a versión en español: Generador y Auditor de Headers CORS Privado

Generate and audit production HTTP CORS (Cross-Origin Resource Sharing) headers for Nginx, Express.js, and Cloudflare Workers 100% locally in your browser. Automatically catch browser-breaking traps like pairing Access-Control-Allow-Origin: * with Allow-Credentials: true or omitting Vary: Origin on CDN caches.

Triggers Preflight OPTIONS? YES (Authorization header)
CDN Vary Requirement Vary: Origin (Mandatory)
Browser Spec Compliance 100% Valid (WHATWG Fetch)
CORS Security Score 95 / 100 Hardened
Validating CORS rules...

WHATWG Fetch CORS Spec Traps (Why APIs Break in Browsers)

Header Combination Browser Behavior Production Root Cause
Origin: * + Credentials: trueHard Browser RejectionProhibited by Fetch spec; must echo a strictly allowlisted exact origin
Dynamic Origin without Vary: OriginCDN Cache PoisoningShared caches serve Origin A's CORS headers to Origin B users
Content-Type: application/jsonForces OPTIONS PreflightOnly text/plain, form-urlencoded, and multipart stay "simple"
Max-Age: 86400 (24h)Trims Preflight RoundtripsChromium caps cache internally at 2 hours (7200s); Firefox allows 24 hours

CORS Validation & Preflight Decision Logic

Browser Evaluation Rules:
• Simple Request = Method in {GET, HEAD, POST} AND safe CORS headers AND Content-Type in safelist.
• Credentialed Requests = Allow-Credentials: true strictly forbids wildcard * in Origin, Methods, or Headers.
• Whenever matching multiple origins dynamically, always append Vary: Origin before CDN edge caching.

HTTP CORS & Preflight FAQ

Why does my API work in Postman or curl yet fail in Chrome with a CORS error?
CORS is strictly enforced by web browsers under the Same-Origin Policy, never by server-to-server HTTP clients. If an OPTIONS preflight returns 401 or omits Access-Control-Allow-Origin before auth middleware runs, browsers reject the request.

Why is blindly reflecting the incoming Origin header dangerous?
Echoing unvalidated Origin headers alongside Allow-Credentials: true effectively turns off Same-Origin protection, letting malicious third-party tabs read authenticated API responses.

Canonical Specifications: MDN CORS Guide · WHATWG Fetch Living Standard · Cross-Origin Resource Sharing Overview.

100% offline browser execution: zero API origins or config snippets ever leave your machine.

Suscribirse Subscribe