Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Vercel preset: no way to key ISR entries by request header (Vary is ignored)

Open
#4,876 0 comments 1 reaction 0 assignees View on GitHub

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
Domain
backend, devops

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

enhancement preset:vercel v3
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

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nitrojs/nitro

All issues in nitrojs/nitro

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.