cloudflare/vinext

RSC redirect returns raw 307 instead of 200 with flight redirect payload

已关闭

#1,347 创建于 2026年5月20日

 (1 条评论) (0 个反应) (0 位负责人)TypeScript (384 个派生)github user discovery
adapter-api-e2ehelp wanted

仓库指标

星标
 (8,625 个星标)
PR 合并指标
 (平均合并 1天 1小时) (30 天内合并 462 个 PR)

描述

This issue was created by an agent analysing CI failures from the Next.js Deploy Suite (vinext main vs Next.js v16.2.6, 2026-05-20).

Problem

When a server component calls redirect() and the request includes the Rsc header (indicating a client-side RSC navigation), Next.js responds with HTTP 200 and encodes the redirect instruction inside the RSC flight payload. vinext sends a raw HTTP 307 redirect, which breaks the client-side router since it expects a 200 with an RSC flight payload.

Similarly, when generateMetadata calls redirect(), the SSR response should still be 200 (metadata is suspended/streamed), not 307.

Expected: 200
Received: 307  // RSC request with Rsc header

Expected: 200
Received: 307  // redirect in generateMetadata

Estimated Impact

~3 test failures across the deploy suite.

Affected Test Suites

  • test/e2e/app-dir/rsc-redirect/rsc-redirect.test.ts (1 failure)
  • test/e2e/app-dir/metadata-navigation/metadata-navigation.test.ts (2 failures)

Recommendation

  1. Reproduce first in vinext's own test suite. Add a test with a server component that calls redirect(), make a request with the Rsc header, and assert the response is 200 with a flight redirect payload. Confirm it fails.

  2. Intercept redirect() in the RSC entry. When rendering an RSC response and redirect() is called, catch the redirect and encode it as a flight redirect response (HTTP 200 with the redirect target in the RSC stream) instead of letting the raw 307 propagate.

  3. Study the Next.js flight redirect format. Search .nextjs-ref/packages/next/src/server/ for how redirects are serialized in RSC flight payloads.

贡献者指南