-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Closed as not planned
Closed as not planned
Copy link
Labels
Dynamic RoutesRelated to dynamic routes.Related to dynamic routes.
Description
Link to the code that reproduces this issue
https://github.com/salazarm/nextjs-missing-prefetch-header/tree/main/nextjs-missing-prefetch-header
To Reproduce
-
Build the repo app
npm run devand start itnpm run start. -
Observe in the network panel that we're prefetching the same url twice, once with the
next-router-prefetchheader set and once without.From the guide here:
I'm using:
missing: [
{ type: 'header', key: 'next-router-prefetch' },
{ type: 'header', key: 'purpose', value: 'prefetch' },
],
But since sometimes the prefetch doesn't include next-router-prefetch we end up including the CSP on those and in my case the CSP is 7kb and we make a lot of prefetch requests so it adds up quickly.
Current vs. Expected behavior
- I expected all prefetch requests to include the
next-router-prefetchheader - I expect to only prefetch the 123 route once.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 25.0.0: Wed Sep 17 21:41:26 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T6041
Available memory (MB): 49152
Available CPU cores: 14
Binaries:
Node: 22.19.0
npm: 10.9.3
Yarn: N/A
pnpm: N/A
Relevant Packages:
next: 16.0.1 // Latest available version is detected (16.0.1).
eslint-config-next: N/A
react: 19.2.0
react-dom: 19.2.0
typescript: 5.9.3
Next.js Config:
output: N/AWhich area(s) are affected? (Select all that apply)
Not sure, Dynamic Routes
Which stage(s) are affected? (Select all that apply)
next build (local), Vercel (Deployed)
Additional context
No response
Metadata
Metadata
Assignees
Labels
Dynamic RoutesRelated to dynamic routes.Related to dynamic routes.