Skip to content

fix: add Vary: Origin so caches key CORS responses per-origin - #313

Merged
Gauravjeetsingh merged 1 commit into
KhalisFoundation:devfrom
divyanshugarg36:fix-cors-vary-origin
Oct 7, 2026
Merged

Gauravjeetsingh merged 1 commit into
KhalisFoundation:devfrom
divyanshugarg36:fix-cors-vary-origin

Conversation

@divyanshugarg36

Copy link
Copy Markdown
Contributor

Responses are cacheable (cacheControl maxAge 21600) and carry a per-origin Access-Control-Allow-Origin, but sent no Vary header. Shared caches therefore keyed only by URL, so a response cached under one origin was replayed to another origin on the same base domain (which share a browser cache partition), serving the wrong Access-Control-Allow-Origin and failing CORS. Varying on Origin makes caches store a copy per origin.

Responses are cacheable (cacheControl maxAge 21600) and carry a
per-origin Access-Control-Allow-Origin, but sent no Vary header. Shared
caches therefore keyed only by URL, so a response cached under one origin
was replayed to another origin on the same base domain (which share a
browser cache partition), serving the wrong Access-Control-Allow-Origin
and failing CORS. Varying on Origin makes caches store a copy per origin.
@Gauravjeetsingh
Gauravjeetsingh merged commit 7e01123 into KhalisFoundation:dev Oct 7, 2026
2 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants