Skip to content

Set x-matched-path fixing dynamic routing #51

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

Closed
wants to merge 1 commit into from

Conversation

hanford
Copy link
Contributor

@hanford hanford commented Jan 4, 2023

This PR ensures x-matched-path is set, so Next.js#handleRequest is able to recognize and render dynamic routes.

It appears Next.js uses this header pretty extensively in it's base-server, to determine whether or not we're in an edge runtime. Without this header, Next.js doesn't match the URL segments resulting in a "Internal Server Error" page.

I'm happy to change any part of this PR, but think this might be one of the "cleaner" solutions I've been able to come up with.


I've also created a reproduction of this bug, along with a patched version of next-on-pages that proves that this solution works over here: https://github.com/hanford/next-on-pages-32

closes #32

@changeset-bot
Copy link

changeset-bot bot commented Jan 4, 2023

⚠️ No Changeset found

Latest commit: 1b20511

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

@hanford
Copy link
Contributor Author

hanford commented Jan 5, 2023

Hmmmm.. going to close this until I can get it working 100%

@hanford hanford closed this Jan 5, 2023
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.

Dynamic routing doesn't work.
1 participant