fix(rsc): include cookies in RSC navigation and prefetch requests#123
Merged
FredKSchott merged 1 commit intocloudflare:mainfrom Feb 27, 2026
Merged
Conversation
RSC navigation and prefetch fetches were missing , causing browsers to omit cookies from these requests. This silently broke cookie-based authentication (Better Auth, NextAuth, etc.) during client-side navigation: a full-page load would succeed (cookies sent normally) but any subsequent <Link> navigation to a protected route would fail authentication because the RSC fetch arrived without the session cookie. Three fetch call sites are fixed: - server/app-dev-server.ts — __VINEXT_RSC_NAVIGATE__ navigation fetch - shims/link.tsx — <Link> prefetch on viewport intersection - shims/navigation.ts — router.prefetch() call
Collaborator
|
Thanks @SeolJaeHyeok! Pushed a commit that changes Why |
commit: |
southpolesteve
added a commit
that referenced
this pull request
Feb 27, 2026
Co-authored-by: ask-bonk[bot] <ask-bonk[bot]@users.noreply.github.com> Co-authored-by: southpolesteve <southpolesteve@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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