feat(nextjs): Add URL to tags of server components and generation functions issues#16500
Merged
RulaKhaled merged 8 commits intodevelopfrom Jun 16, 2025
Merged
feat(nextjs): Add URL to tags of server components and generation functions issues#16500RulaKhaled merged 8 commits intodevelopfrom
RulaKhaled merged 8 commits intodevelopfrom
Conversation
chargome
approved these changes
Jun 16, 2025
Member
chargome
left a comment
There was a problem hiding this comment.
LGTM! Could you also add a test case for a generation function in of the e2e tests?
mydea
reviewed
Jun 17, 2025
|
|
||
| const spanData = spanToJSON(rootSpan); | ||
|
|
||
| if (spanData.data && 'http.target' in spanData.data) { |
Member
There was a problem hiding this comment.
l: this can be simplified to:
if (typeof spanData.data['http.target'] === 'string') {
pathname = spanData.data['http.target'];
}spanData.data should never be empty I believe, and we can just check for stringiness and then avoid the typecase below :)
mydea
reviewed
Jun 17, 2025
|
|
||
| const spanData = spanToJSON(rootSpan); | ||
|
|
||
| if (spanData.data && 'http.target' in spanData.data) { |
mydea
reviewed
Jun 17, 2025
| * @param params - Optional route parameters to replace in the template | ||
| * @param headersDict - Optional headers containing protocol and host information | ||
| * @param pathname - Optional pathname coming from parent span "http.target" | ||
| * @returns A sanitized URL string |
Member
There was a problem hiding this comment.
l: I would always mention here if things are only exported for tests, for clarity. In this file, I believe only getSanitizedRequestUrl is actually used, all the other exports are for tests only right? By mentioning this with each export is is easier to follow why things are exported (vs. "hey can I un-export this because it is not actually used anyhwere?")
s1gr1d
added a commit
that referenced
this pull request
Jun 23, 2025
…` headers (#16687) Adds support for [x-forwarded-host](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/X-Forwarded-Host) (host forwarding) and [x-forwarded-proto](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/X-Forwarded-Proto) (protocol forwarding). This is useful when using proxies. Closes #16671 Support for this was also added [in this PR for Next.js](#16500)
andreiborza
pushed a commit
that referenced
this pull request
Jun 23, 2025
…` headers (#16687) Adds support for [x-forwarded-host](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/X-Forwarded-Host) (host forwarding) and [x-forwarded-proto](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/X-Forwarded-Proto) (protocol forwarding). This is useful when using proxies. Closes #16671 Support for this was also added [in this PR for Next.js](#16500)
3 tasks
This was referenced Sep 29, 2025
This was referenced Oct 7, 2025
This was referenced Oct 15, 2025
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’s uses an internal AsyncLocalStorage (ALS) to share minimal request context—it deliberately does not populate the full Request object or URL in ALS, so only headers (Referer, x-forwarded-host, x-forwarded-proto) are available at runtime in Server Components.
To still capture a usable URL for metadata we use a three-step best-effort fallback:
Refererheader Use it as the fully qualified URL if present (note: this could be omitted by the browser).closes: https://linear.app/getsentry/issue/JS-487/capture-requesturl-for-nextjs-server-spans