[PR #93] [MERGED] fix: include relevant headers in fetch cache key #303

Closed
opened 2026-05-06 12:39:04 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/93
Author: @southpolesteve
Created: 2/26/2026
Status: Merged
Merged: 2/26/2026
Merged by: @southpolesteve

Base: mainHead: fix/fetch-cache-key


📝 Commits (1)

  • 6383f37 fix: include relevant headers in fetch cache key

📊 Changes

2 files changed (+265 additions, -6 deletions)

View changed files

📝 packages/vinext/src/shims/fetch-cache.ts (+77 -6)
📝 tests/fetch-cache.test.ts (+188 -0)

📄 Description

Summary

Fetch cache keys now incorporate Authorization, Cookie, and X-API-Key headers when present, preventing cache collisions between requests with different credentials.

  • When per-user auth headers are present, they are included in the cache key so different callers get separate cache entries
  • As a safe default, requests with auth headers bypass the cache unless the developer explicitly opts in via cache: 'force-cache' or next: { revalidate: N }
  • Also adds cache: 'no-cache' to the bypass conditions alongside no-store

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/93 **Author:** [@southpolesteve](https://github.com/southpolesteve) **Created:** 2/26/2026 **Status:** ✅ Merged **Merged:** 2/26/2026 **Merged by:** [@southpolesteve](https://github.com/southpolesteve) **Base:** `main` ← **Head:** `fix/fetch-cache-key` --- ### 📝 Commits (1) - [`6383f37`](https://github.com/cloudflare/vinext/commit/6383f3725b9511816a0ec155a822b1bd61f1e36e) fix: include relevant headers in fetch cache key ### 📊 Changes **2 files changed** (+265 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/shims/fetch-cache.ts` (+77 -6) 📝 `tests/fetch-cache.test.ts` (+188 -0) </details> ### 📄 Description ## Summary Fetch cache keys now incorporate Authorization, Cookie, and X-API-Key headers when present, preventing cache collisions between requests with different credentials. - When per-user auth headers are present, they are included in the cache key so different callers get separate cache entries - As a safe default, requests with auth headers bypass the cache unless the developer explicitly opts in via `cache: 'force-cache'` or `next: { revalidate: N }` - Also adds `cache: 'no-cache'` to the bypass conditions alongside `no-store` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 12:39:04 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#303
No description provided.