Vary: Origin HTTP Origin: Network OSI layer 7 · Application Last updated 18 Nov 2026

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.

Exact message you may see CORS works in one site but not another cachedmissing Vary: Origin CORS cacheCORS error intermittently CDN cached Access-Control-Allow-OriginVary: Origin header
Seen on: HTTP Browser Cloudflare

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

  1. Add Vary: Origin whenever Allow-Origin is dynamic
  2. Include Origin in the CDN cache key (or bypass cache)
  3. Purge cached CORS responses

Detailed fix by platform

Express

  1. res.set("Vary", "Origin");

How to diagnose

  1. Allow-Origin — Dynamic?
  2. Vary — Origin set?
  3. 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:

Where this error sits

Origin: Network. Errors that are often confused with or caused by this one (click to open):

404 — 404 on JS/CSS assets after a new deploy (HTTP)404405 — 405 Method Not Allowed on OPTIONS (CORS preflight) (HTTP)405axios — Axios "Network Error" with no response (CORS, DNS, offline or mixed content) (HTTP)axiosCache-Control — CDN not caching: Cache-Control private / no-cache / Set-Cookie on the response (HTTP)Cache-ControlCache-Control — Back/forward cache blocked by Cache-Control: no-store (stale or reloaded page on Back) (HTTP)Cache-ControlCDN cache — CDN or browser serving stale content after a deploy (HTTP)CDN cacheCORS — CORS Error: No 'Access-Control-Allow-Origin' header is present (API)CORSCORS — CORS: wildcard '*' not allowed when the request's credentials mode is 'include' (HTTP)CORSVary: Ori…

Explore the map of this error Full error map →

🧠 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.