Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

chanceaclark
Copy link
Contributor

What/Why?

Testing

Copy link

vercel bot commented Jun 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
catalyst-latest ❌ Failed (Inspect) 💬 Add feedback Jun 7, 2024 8:28pm
5 Ignored Deployments
Name Status Preview Comments Updated (UTC)
catalyst-1millionproducts-store ⬜️ Ignored (Inspect) Visit Preview Jun 7, 2024 8:28pm
catalyst-au ⬜️ Ignored (Inspect) Visit Preview Jun 7, 2024 8:28pm
catalyst-ppr ⬜️ Ignored (Inspect) Visit Preview Jun 7, 2024 8:28pm
catalyst-test-store ⬜️ Ignored (Inspect) Visit Preview Jun 7, 2024 8:28pm
catalyst-uk ⬜️ Ignored (Inspect) Visit Preview Jun 7, 2024 8:28pm

Copy link

changeset-bot bot commented Jun 6, 2024

⚠️ No Changeset found

Latest commit: 147f1ee

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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));
Copy link
Contributor

@BC-krasnoshapka BC-krasnoshapka Jun 7, 2024

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?

Copy link
Contributor Author

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.

Copy link
Contributor

github-actions bot commented Jun 7, 2024

⚡️🏠 Lighthouse report

Lighthouse ran against https://catalyst-latest-lwaizduhb-bigcommerce-platform.vercel.app

🖥️ Desktop

We ran Lighthouse against the changes on a desktop and produced this report. Here's the summary:

Category Score
🟢 Performance 99
🟢 Accessibility 93
🟢 Best practices 100
🟠 SEO 60

📱 Mobile

We ran Lighthouse against the changes on a mobile and produced this report. Here's the summary:

Category Score
🟢 Performance 93
🟢 Accessibility 93
🟢 Best practices 100
🟠 SEO 67

@chanceaclark
Copy link
Contributor Author

Closing this PR as I have created an issue with the Next.js team vercel/next.js#66837

@chanceaclark chanceaclark deleted the fix-auth branch October 22, 2024 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants