Repository navigation
fix(browser): Send same-origin string tunnels as application/x-sentry-envelope - #26299
Merged
Merged
Conversation
Contributor
size-limit report 📦Compared: 3b4f402 (PR test merge using develop at 86c5981) Against: 86c5981 (develop) · base run #65750 ✅ Baseline matches: this diff contains only this PR's changes.
|
Contributor
Optional E2E testsSome optional checks were not successful. They do not block the merge. 7 not successful, 19 successful. See the run.
Successful checks
|
logaretm
marked this pull request as ready for review
November 11, 2026 14:15
logaretm
requested review from
s1gr1d
and removed request for
stephanie-anderson
November 11, 2026 14:18
mydea
approved these changes
Nov 11, 2026
logaretm
force-pushed
the
awad/same-origin-tunnel-content-type
branch
from
November 11, 2026 16:00
be1f0da to
bf140e1
Compare
51 tasks done
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.
While writing the docs for the new tunnel API i realized we have a discrepency in behavior regarding the headers set on a tunnel request.
Before: We set the
application/x-sentry-envelopeonly if the user uses the new API options, so eithertunnel: trueortunnel: { path: '/monitor' }. So thetunnel: '/monitor'option doesn't set that header.The reasoning is we were worried about breaking CORS preflight header checks by adding that header, which is still a valid concern however it would typically apply to requests to a different origin. Requests on the same origin wouldn't trigger a preflight check, so the header has no risk there.
On all SDKs that doesn't really matter, but for Next.js it can break the tunnel if the user uses the new API directly with a fixed path like so:
The way it works specifically on Next.js is that we match the route on vercel deployments using a re-write rule that targets any path with a
application/x-sentry-envelopeheader, if the user uses the previous snippet the header is never sent so the tunnel never works.Our shipped PRs wouldn't trigger this issue on their own because the new docs don't recommend this yet. Our merged implementation actually ensures the header to applied, but by accident since we normalize to
tunnel: { path }format which uses the new API.After: Now the distinction is different but more consistent, external URLs won't receive the header, while same origin requests will. This is a safer default.