CORS responses cached for the wrong origin (missing Vary: Origin)
A cache or CDN stored a CORS response for one origin and served it to another, so some sites get blocked.
CORS works in one site but not another cachedmissing Vary: Origin CORS cacheCORS error intermittently CDN cached Access-Control-Allow-OriginVary: Origin header Meaning
When Access-Control-Allow-Origin is reflected per request, responses differ by Origin. Without Vary: Origin, a CDN or browser cache can return the header for a different site, causing random CORS failures. Add Vary: Origin.
Common causes
- Dynamic Allow-Origin without
Vary: Origin - CDN caching responses by URL only
- Browser cache reusing a response across origins
- Multiple front-ends using one API
- Header overwritten by the proxy
⚡ Quick fix
- Add
Vary: Originwhenever Allow-Origin is dynamic - Include Origin in the CDN cache key (or bypass cache)
- Purge cached CORS responses
Detailed fix by platform
Express
res.set("Vary", "Origin");
How to diagnose
- Allow-Origin — Dynamic?
- Vary — Origin set?
- CDN key — Includes Origin?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in HTTP
Other ways to find it
Where this error sits
Origin: Network. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 18 Nov 2026