-
Notifications
You must be signed in to change notification settings - Fork 187
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
fix(core): fix redirects causing middleware to break #980
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
5 Ignored Deployments
|
|
if (request.headers.has('x-action-redirect')) { | ||
const redirectUrl = new URL(request.headers.get('x-action-redirect') ?? '', request.url); | ||
|
||
return NextResponse.rewrite(new URL(`/${locale}${redirectUrl.pathname}`, request.url)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chanceaclark what's the case for this rewrite? I've just noticed that it handles prefix based locales strategy domain.com/en
only. i18n supports subdomain based en.domain.com
also. Should it be handled here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add more info once I move this PR from Draft -> Open, but [email protected]+
changed redirection behavior inside server actions causing things like login to break. I am not finished with this PR and this may not even be the fix for this issue, but if it is I still have other edge cases like external and absolute/relative redirects to test.
⚡️🏠 Lighthouse reportLighthouse ran against https://catalyst-latest-lwaizduhb-bigcommerce-platform.vercel.app 🖥️ DesktopWe ran Lighthouse against the changes on a desktop and produced this report. Here's the summary:
📱 MobileWe ran Lighthouse against the changes on a mobile and produced this report. Here's the summary:
|
Closing this PR as I have created an issue with the Next.js team vercel/next.js#66837 |
What/Why?
Testing