mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #123] [MERGED] fix(rsc): include cookies in RSC navigation and prefetch requests #330
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#330
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/123
Author: @SeolJaeHyeok
Created: 2/26/2026
Status: ✅ Merged
Merged: 2/27/2026
Merged by: @FredKSchott
Base:
main← Head:fix/rsc-navigation-credentials📝 Commits (1)
ae046a7fix(rsc): include cookies in RSC navigation and prefetch requests📊 Changes
3 files changed (+3 additions, -0 deletions)
View changed files
📝
packages/vinext/src/server/app-dev-server.ts(+1 -0)📝
packages/vinext/src/shims/link.tsx(+1 -0)📝
packages/vinext/src/shims/navigation.ts(+1 -0)📄 Description
Summary
RSC navigation and prefetch requests were missing
credentials: 'include',causing browsers to silently omit cookies from these requests. This broke
cookie-based authentication (Better Auth, NextAuth, etc.) during client-side
navigation.
Root cause: A full-page reload works correctly — the browser always sends
cookies with HTML navigation requests. But when a user clicks a
<Link>, vinextfetches the RSC payload via
fetch(), and withoutcredentials: 'include'thebrowser omits all cookies from the request. The server receives no session cookie
and authentication fails.
Three call sites fixed:
server/app-dev-server.ts__VINEXT_RSC_NAVIGATE__— actual navigation fetchshims/link.tsx<Link>prefetch triggered on viewport intersectionshims/navigation.tsrouter.prefetch()programmatic prefetchReproduction
A full page refresh on the protected route always worked correctly. Only
client-side navigation was affected.
Notes
same-origin (they go to the same vinext dev server / production host), so this
cannot cause credential leakage to third parties. Rewrites to external origins
are handled by the server-side proxy which already strips cookies before
forwarding.
consumed — no change to that logic.
Fixes #85
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.