Server action redirect with absolute internal URL duplicates basePath #64557
Labels
bug
Issue was opened via the bug report template.
locked
Navigation
Related to Next.js linking (e.g., <Link>) and navigation.
Link to the code that reproduces this issue
https://github.com/sk-1982/nextjs-absolute-url-redirect-basepath-bug
To Reproduce
localhost:3000/web
Current vs. Expected behavior
Current: Clicking the "Absolute URL Redirect" button sends the user to a 404 page. Reloading the page shows the correct test page. This is because #60798 made redirects with absolute internal URLs identical to relative URLs. However, this does not consider that the absolute URL will contain
basePath
. As a result, the redirect is equivalent toredirect('/web/test')
, which resolves tohttp://localhost:3000/web/web/test
(which doesn't exist).Expected: redirects with an absolute internal URL should remove the base path and correctly redirect.
Provide environment information
Which area(s) are affected? (Select all that apply)
Routing (next/router, next/navigation, next/link)
Which stage(s) are affected? (Select all that apply)
next dev (local), next start (local), Vercel (Deployed), Other (Deployed)
Additional context
Also see related issue: #64413
The text was updated successfully, but these errors were encountered: