Vercel preset: no way to key ISR entries by request header (Vary is ignored)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- typescript
Research direction
Start by tracing the Vercel preset's ISR route generation and cache key handling; the issue does not name implementation files or tests. Check whether Vercel supports varying ISR cache entries by request headers, then decide whether to add a header key option or document the limitation and warn when an ISR response sets Vary. Done means the selected behavior is covered by a regression test or a clear warning and documentation.
Written by the indexing model from the issue text.
Description
Describe the feature
On the vercel preset there is no way to keep ISR entries apart by a request header. Vercel's ISR cache ignores Vary, and the isr route rule only offers allowQuery/passQuery, so a handler that varies on a header serves the first variant to everyone. This affects frameworks that answer partial requests on the same URL (for example htmx's HX-Request).
Environment: [email protected], preset vercel.
Repro: https://github.com/thejackshelton/nitro-vercel-isr-vary-repro (deployed at https://nitro-vercel-isr-vary-repro.vercel.app)
// nitro.config.ts
routeRules: { "/isr-vary": { isr: 60 } }
// routes/isr-vary.ts
export default defineHandler((event) => {
event.res.headers.set("vary", "x-fragment");
const kind = event.req.headers.get("x-fragment") === "1" ? "FRAGMENT" : "DOCUMENT";
return `${kind} at ${Date.now()}`;
});
Expected: a request with x-fragment: 1 gets FRAGMENT.
Actual:
$ curl -si https://nitro-vercel-isr-vary-repro.vercel.app/isr-vary
HTTP/2 200
vary: x-fragment
x-vercel-cache: MISS
DOCUMENT at 1792558314240
$ curl -si -H "x-fragment: 1" https://nitro-vercel-isr-vary-repro.vercel.app/isr-vary
HTTP/2 200
vary: x-fragment
x-vercel-cache: HIT
DOCUMENT at 1792558314240
Mapping the header to an allowQuery key with a has route in vercel.config.routes (/isr-split in the repro) is shared the same way, so I found no user-land workaround.
Request: an isr option to key entries by named request headers, or, if Vercel cannot support it, a documented limitation and a warning when an ISR response sets Vary.
Additional information
- Would you be willing to help implement this feature?
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 932
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 164
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nitrojs/nitro
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
v2: backport #4683 (a package's own entry is externalized as `pkg/`, DEP0155)Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 71/100
Maintainers usually reply within 1 day
-
bug externals nuxt v2 windows
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
nitrojs/nitro#4761 · 1 comment ·
Maintainers usually reply within 1 day
-
documentation v3
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
bug v2
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
nitrojs/nitro#4555 · 5 comments ·
Maintainers usually reply within 1 day
Similar issues
-
bug hacktoberfest help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
libredb/libredb-studio#1941 ·
Maintainers usually reply within 1 day
-
chore other
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
alastair-smith/card-games#308 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
paperclipai/paperclip#17379 ·
Maintainers usually reply within 1 day
-
[good first issue, hacktoberfest] 🏯 Hacktoberfest Task - Add new Anime Quote 626 (good-first-issue)Opencommunity first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 76/100
lingdojo/kana-dojo#33040 · 1 comment · 5 reactions ·
Maintainers usually reply within 1 day
-
bug mobile ui
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day