However, this is incorrect since we have a middleware that says if there's a pw query param, redirect to https://dub.co. Refreshing the page fixes this.
Current vs. Expected behavior
Current: redirect() does a "soft" redirect and doesn't actually refresh the router
Expected: redirect() triggers a router refresh and redirects to the final URL (https://dub.co) (as per the docs)
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 22.6.0: Fri Sep 15 13:41:28 PDT 2023; root:xnu-8796.141.3.700.8~1/RELEASE_ARM64_T6000
Binaries:
Node: 20.9.0
npm: 10.2.4
Yarn: 1.22.21
pnpm: 8.10.5
Relevant Packages:
next: 14.1.1-canary.59 // Latest available version is detected (14.1.1-canary.59).
eslint-config-next: 14.1.0
react: 18.2.0
react-dom: 18.2.0
typescript: 5.3.3
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
i have same issue. on my middleware file i check the user auth with cookie and make some routing for user role or user auth session. for routing work i need the refresh page.
Link to the code that reproduces this issue
https://github.com/steven-tey/server-action-redirect-bug
To Reproduce
Go to https://server-action-redirect-bug.vercel.app/, type in any password and click "Log In". You'll see the URL change to have the
?pw=
query param:However, this is incorrect since we have a middleware that says if there's a
pw
query param, redirect tohttps://dub.co
. Refreshing the page fixes this.Current vs. Expected behavior
Current:
redirect()
does a "soft" redirect and doesn't actually refresh the router Expected:redirect()
triggers a router refresh and redirects to the final URL (https://dub.co
) (as per the docs)Provide environment information
Which area(s) are affected? (Select all that apply)
App Router, Routing (next/router, next/navigation, next/link)
Which stage(s) are affected? (Select all that apply)
next dev (local), Vercel (Deployed)
Additional context
This used to work before
next@14.1.1
I believeNEXT-2840