mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #759] [MERGED] fix: validate redirect status codes in NextResponse.redirect() #823
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#823
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/759
Author: @NathanDrake2406
Created: 4/3/2026
Status: ✅ Merged
Merged: 4/3/2026
Merged by: @james-elicx
Base:
main← Head:fix/redirect-status-validation📝 Commits (1)
67f1223fix: validate redirect status codes in NextResponse.redirect()📊 Changes
2 files changed (+31 additions, -0 deletions)
View changed files
📝
packages/vinext/src/shims/server.ts(+6 -0)📝
tests/shims.test.ts(+25 -0)📄 Description
Summary
NextResponse.redirect()accepted any status code without validationredirect(url, 200)silently created a non-redirect response — browser won't follow Location header on non-3xx statusRangeErrorfor invalid redirect status codes (anything not 301/302/303/307/308), matching Next.js behaviorTest plan
redirect(url, 200)throws RangeErrorredirect(url, 418)throws RangeErrorredirect(url, 303)succeeds (was missing coverage)redirect(url, 307)defaults correctly (existing, regression)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.