-
Notifications
You must be signed in to change notification settings - Fork 26.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
redirect()
function doesn't consider basePath
#54163
Comments
I don't think this is a bug. |
Please give some reason. Someone may say 'this is by design', I prepared another testcase.
The behavior is not consistent. |
This is definitely a bug 👍 |
@XDean You are right. |
### What & Why Add base path handling for the url in redirect error if the `basePath` is configured. This is only break for server rendering case as the `basePath` is missing in the `Location` header. When running `next build`, everything is managed well with app router and base path on client side so it didn't break. ### How Adding `basePath` if it's presented for `Location` header. Update the `RenderOpts` type as basePath is already passed down in it, also update them for turbopack entries Fixes #54163 Closes NEXT-1529
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
Which area(s) of Next.js are affected? (leave empty if unsure)
App Router
Link to the code that reproduces this issue or a replay of the bug
https://github.com/XDean/next-bug/tree/redirect-function-basepath
To Reproduce
/dev/redirect
/target
. The correct path should be/dev/target
Describe the Bug
The
redirect
function should considerbasePath
config. But it not.Another strange behavior is, If you access
/dev/link
, click the link redirect to/direct
, it works.Expected Behavior
redirect('/target)
can goto/dev/target
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
NEXT-1529
The text was updated successfully, but these errors were encountered: