You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Document CORS settings for browser trace propagation #11351
As documented here, users need to configure Access-Control-Allow-Headers when the frontend and the backend are on different (sub) domains to allow trace propagation headers to be passed down with XHR requests.
Users may easily miss the docs and end up with a broken experience / spend much time trying to find the problem.
Solution Brainstorm
Here are two possible solutions:
Prominently link to the CORS documentation during setup. This would affect all backend platforms. Consider adding a snippet in an expandable section.
Automatically make all backend SDKs send these response headers - maybe guarded by a config option as part of the default init snippet.
We cannot override how CORS headers are being set via the backend SDKs because this is a security concern. It can only be configured by users, so I think option 1 is the only viable solution here.
What we also need to make prominent is to make sentry-trace and baggage allow-listed as valid headers. Some people have strict nginx or apache configs that only allow a subset of headers through (our infrastructure at Sentry does this).
@obecny I think trying to identify network failures as CORS issues vs. actual errors gets unreliable, but if there is a way forward we can take a look. As far as I'm aware it doesn't work very well, so I don't think we should spend too much time on it.
CORS errors are purposefully sand boxed, but perhaps we can go to W3C and see if the browser vendors are open to an alternate instrumentation strategy?
Activity
AbhiPrasad commentedon Oct 26, 2023
We cannot override how CORS headers are being set via the backend SDKs because this is a security concern. It can only be configured by users, so I think option 1 is the only viable solution here.
What we also need to make prominent is to make
sentry-traceandbaggageallow-listed as valid headers. Some people have strict nginx or apache configs that only allow a subset of headers through (our infrastructure at Sentry does this).[-]Make CORS configuration more intuitive/obvious[/-][+]Document CORS settings for browser trace propagation[/+]getsantry commentedon Sep 13, 2024
Auto-routing to @getsentry/product-owners-issues for triage ⏲️
getsantry commentedon Sep 13, 2024
Routing to @getsentry/product-owners-sdks-web-frontend for triage ⏲️
17 remaining items
AbhiPrasad commentedon Oct 17, 2024
@obecny I think trying to identify network failures as CORS issues vs. actual errors gets unreliable, but if there is a way forward we can take a look. As far as I'm aware it doesn't work very well, so I don't think we should spend too much time on it.
CORS errors are purposefully sand boxed, but perhaps we can go to W3C and see if the browser vendors are open to an alternate instrumentation strategy?
smeubank commentedon Jan 15, 2025
related bordering on duplicate: #11524