-
Notifications
You must be signed in to change notification settings - Fork 29.9k
Open
Labels
RedirectsRelated to redirecting.Related to redirecting.RuntimeRelated to Node.js or Edge Runtime with Next.js.Related to Node.js or Edge Runtime with Next.js.Server ActionsRelated to Server Actions.Related to Server Actions.
Description
Link to the code that reproduces this issue
https://github.com/greenlynx/nextjs-bad-redirect-repro
To Reproduce
Our application has a base path set, and a form that submits to a server action that causes a redirect. When the app is tested using Playwright, and the form is submitted before the page is hydrated, the redirect location in the 303 response is wrong (it is missing the base path).
Steps to reproduce
- Disable Javascript in browser
pnpm dev- Click submit button
Current vs. Expected behavior
Current behaviour
- Redirect to
/successand see a 404 error (because the base path/customwas not prepended to the redirect location)
Expected behaviour
- Redirect to
/custom/success, and see "OK" message
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:40 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6041
Available memory (MB): 49152
Available CPU cores: 14
Binaries:
Node: 22.20.0
npm: 10.9.3
Yarn: 1.22.22
pnpm: 10.18.3
Relevant Packages:
next: 16.0.1-canary.5 // Latest available version is detected (16.0.1-canary.5).
eslint-config-next: N/A
react: 19.2.0
react-dom: 19.2.0
typescript: 5.9.3
Next.js Config:
output: N/AWhich area(s) are affected? (Select all that apply)
Redirects, Server Actions, Runtime
Which stage(s) are affected? (Select all that apply)
next dev (local), Other (Deployed), Vercel (Deployed)
Additional context
No response
Metadata
Metadata
Assignees
Labels
RedirectsRelated to redirecting.Related to redirecting.RuntimeRelated to Node.js or Edge Runtime with Next.js.Related to Node.js or Edge Runtime with Next.js.Server ActionsRelated to Server Actions.Related to Server Actions.