The issue involves a cache key mismatch in RSC prefetch mechanism with proxy-rewritten routes.
The issue is a cache key mismatch in the RSC prefetch mechanism when using proxy-rewritten routes. The prefetch caches the response under the visible URL, but the proxy adds hidden search params, causing the cache key to not match the actual fetch. This requires understanding of both the RSC prefetch mechanism and proxy behavior.
https://github.com/VeiaG/nextjs-proxy-rewrite-prefetch-rsc-bug-
Clone reproduction repo
Important: must be tested with a production build. Does not reproduce in dev mode.
pnpm install
pnpm run deploy
The header has two links:
/test — public URL that is rewritten by the proxy (buggy path)/dynamicPages/filtered — direct URL, no rewrite (works correctly, for comparison)/dynamicPages/filtered link+ to set page=2 → Server searchParams updates ✅reset → Server searchParams updates back to default ✅+ again → updates ✅ — everything works normallyThe root condition: RSC re-fetches only work on /test when the page was loaded with at least one search param already in the URL. The moment the URL has no params — either because you loaded that way or navigated there — RSC re-fetches stop entirely.
Simplest reproduction:
/test (no params)+ or any filter → URL updates but Server searchParams does not change ❌Illustrated with contrast:
/test?page=2 (server renders with params)+ → page goes to 3, Server searchParams updates ✅ — works because page loaded with paramsreset → URL becomes /test (no params), Server shows page=1 (default)+ → URL becomes /test?page=2 but Server searchParams does not update ❌Open the Network tab: no _rsc requests are sent in steps 4–5.
src/proxy.ts — adds testParam=testValue to every rewrite of /test:
export const proxy = (request: NextRequest) => {
if (request.nextUrl.pathname === '/test') {
const url = new
Claim this issue to let others know you're working on it. You'll earn 30 points when you complete it!