Skip to content

feat: redirect kind#315

Merged
lazarv merged 1 commit into
mainfrom
feat/redirect-kind
Feb 28, 2026
Merged

feat: redirect kind#315
lazarv merged 1 commit into
mainfrom
feat/redirect-kind

Conversation

@lazarv

@lazarv lazarv commented Feb 28, 2026

Copy link
Copy Markdown
Owner

Adds a kind parameter to the redirect() function, giving developers control over how redirects behave on the client side.

Motivation

Resolves #289. The default redirect behavior (RSC navigation with replaceState) isn't always what's needed. For example, OAuth flows require a full browser navigation, some redirects should preserve history for back-button support, and server actions sometimes need to signal a redirect to the client without automatically navigating.

API

redirect(url: string, status?: number, kind?: RedirectKind): never

RedirectKind is a union of four values:

Kind Behavior
"navigate" (default) RSC navigation with replaceState — same as current behavior
"push" RSC navigation with pushState — adds a history entry so the user can go back
"location" Full browser navigation via location.href — useful for external URLs or OAuth flows
"error" Throws the redirect error on the client — allows custom handling via try/catch in server actions

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
react-server-docs 520478b Commit Preview URL

Branch Preview URL
Feb 28 2026, 11:35 AM

@lazarv lazarv merged commit 5e24d8f into main Feb 28, 2026
57 checks passed
@lazarv lazarv deleted the feat/redirect-kind branch February 28, 2026 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

redirect a POST rsc-x-component / fetch fails with CORS

1 participant