Skip to content

fix(cloud): forward /api/sentry-tunnel to Sentry ingest#277

Merged
RhysSullivan merged 1 commit intomainfrom
rs/sentry-tunnel
Apr 17, 2026
Merged

fix(cloud): forward /api/sentry-tunnel to Sentry ingest#277
RhysSullivan merged 1 commit intomainfrom
rs/sentry-tunnel

Conversation

@RhysSullivan
Copy link
Copy Markdown
Owner

routes/__root.tsx configures the browser Sentry SDK with
tunnel: '/api/sentry-tunnel' but nothing served that path — every
error report came back RouteNotFound.

Add a request middleware (before the /api/* router) that intercepts
POST /api/sentry-tunnel, parses the envelope's first-line header to
recover the DSN, and forwards the raw body to
https:///api//envelope/. The envelope's DSN is
validated against env.SENTRY_DSN (host + pathname) to keep this from
being an open relay for the Sentry ingest. Missing DSN → 204; bad
envelope → 400.

routes/__root.tsx configures the browser Sentry SDK with
tunnel: '/api/sentry-tunnel' but nothing served that path — every
error report came back RouteNotFound.

Add a request middleware (before the /api/* router) that intercepts
POST /api/sentry-tunnel, parses the envelope's first-line header to
recover the DSN, and forwards the raw body to
https://<dsn host>/api/<project>/envelope/. The envelope's DSN is
validated against env.SENTRY_DSN (host + pathname) to keep this from
being an open relay for the Sentry ingest. Missing DSN → 204; bad
envelope → 400.
@RhysSullivan RhysSullivan merged commit 17c607f into main Apr 17, 2026
@RhysSullivan RhysSullivan deleted the rs/sentry-tunnel branch April 17, 2026 19:03
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.

1 participant