Conversation
Next.js strips the basePath from req.url before running Pages Router data fetchers and API routes, so captured errors reported a request url without it. Use the originally requested path and query from Next.js' initURL request meta instead, keeping the origin from the request headers. Fixes #24975 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit ca14e8d. Configure here.
chargome
marked this pull request as ready for review
October 2, 2026 11:37
chargome
requested review from
logaretm,
nicohrubec and
s1gr1d
and removed request for
a team
October 2, 2026 11:37
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Next.js removes the
basePathfromreq.urlbefore running Pages Router data fetchers and API routes. So errors captured there reported arequest.urlwithout it, for examplehttp://localhost:3000/foo/barinstead ofhttp://localhost:3000/base/foo/bar.Next keeps the URL as it was originally requested in its internal request meta (
initURL), set before thebasePathis removed. We now take the path and query from there. The origin still comes from the request headers, because Next builds the absoluteinitURLfrom its own hostname and port, which can differ from the public host behind a proxy. API routes were affected the same way, so they're covered too.Fixes #24975