A missing fetch option causes unnecessary server-side redirect handling.
The issue involves a missing `redirect: 'manual'` option in the `createRedirectRenderResult` function, which causes server-side redirect handling instead of delegating it to the client. The fix requires adding this option to the fetch call, similar to the `createForwardedActionResponse` function. The scope is clear, and the change is localized.
https://github.com/ajworkos/nextjs-redirect-bug-repro
redirect('/api/login') (or any internal route)/api/login itself calls redirect('https://external-oauth-provider.com/authorize?...') — i.e., it redirects externally<form action={...}> so it goes through the RSC action handler pathExpected: The client receives the redirect and navigates to the external URL.
Actual (Demo 1 — error): If the external URL has a redirect chain (common with OAuth/SSO providers), the server-side fetch in createRedirectRenderResult follows all redirects and hits the "redirect count exceeded" limit, causing a 500 error.
Actual (Demo 2 — latency): Even when the chain is short enough to not error, the server unnecessarily fetches the external redirect target (e.g., a slow OAuth authorization page), adding seconds of wasted latency before the client gets the redirect response.
Current: createRedirectRenderResult in packages/next/src/server/app-render/action-handler.ts makes a fetch() call without redirect: 'manual', causing it to automatically follow the entire redirect chain of the target URL server-side.
Expected: The fetch should use redirect: 'manual' (just like the sibling function createForwardedActionResponse already does), so the redirect is handed back to the client via the x-action-redirect header without following it server-side.
PR #65097 correctly added redirect: 'manual' to the createForwardedActionResponse function but missed applying the same fix to createRedirectRenderResult. The two functions serve similar roles (forwarding action responses), and the inconsistency means createRedirectRenderResult still follows redirects automatically.
The relevant code is at:
// create
Claim this issue to let others know you're working on it. You'll earn 10 points when you complete it!