diff --git a/docs/platforms/javascript/common/configuration/options.mdx b/docs/platforms/javascript/common/configuration/options.mdx index 5bbd92dd268e6..c636ca2d973bd 100644 --- a/docs/platforms/javascript/common/configuration/options.mdx +++ b/docs/platforms/javascript/common/configuration/options.mdx @@ -443,6 +443,27 @@ By default, no spans are ignored. + + + + +_Available since: `10.10.0`_ + +If set to `true`, the SDK adds the [W3C `traceparent` header](https://www.w3.org/TR/trace-context/) to outgoing Http requests made via `fetch` or `XMLHttpRequest`. +This header is attached in addition to the `sentry-trace` and `baggage` headers. +Set this option to `true` if your backend services are instrumented with e.g. OpenTelemetry or other W3C Trace Context compatible libraries and you want to continue traces from the client. + +**Important:** Make sure that your backend services' CORS configuration allows the `traceparent` header. +Otherwise, requests might be blocked. +Use the [`tracePropagationTargets` option](#tracepropagationtargets) to control which requests the `traceparent` header is attached to. +See Dealing with CORS Issues for more information. + +Note that this option is only available for browser SDKs. + + + + + ## Session Replay Options diff --git a/docs/platforms/javascript/common/tracing/distributed-tracing/dealing-with-cors-issues/index.mdx b/docs/platforms/javascript/common/tracing/distributed-tracing/dealing-with-cors-issues/index.mdx index cb93881921bc3..88a87d0a0ff16 100644 --- a/docs/platforms/javascript/common/tracing/distributed-tracing/dealing-with-cors-issues/index.mdx +++ b/docs/platforms/javascript/common/tracing/distributed-tracing/dealing-with-cors-issues/index.mdx @@ -20,7 +20,7 @@ If your frontend and backend are hosted on different domains (for example, your ## Understanding Trace Propagation -Sentry doesn't attach the `sentry-trace` and `baggage` headers to every outgoing request. Instead, it only attaches these headers to requests whose URLs match the patterns specified in the `tracePropagationTargets` configuration option. +Sentry doesn't attach the `sentry-trace` and `baggage` (and optionally `traceparent`) headers to every outgoing request. Instead, it only attaches these headers to requests whose URLs match the patterns specified in the `tracePropagationTargets` configuration option. By default, `tracePropagationTargets` is set to `['localhost', /^\//]`, which means trace headers are only attached to: - Requests containing `localhost` in their URL (e.g., `http://localhost:3000/api`) @@ -55,6 +55,14 @@ Access-Control-Allow-Headers: sentry-trace, baggage Your server's exact configuration will depend on your setup, but the important part is allowing both the `sentry-trace` and `baggage` headers. +### W3C traceparent header + +If you set `propagateTraceparent` option to `true`, you also need to allow the `traceparent` header: + +``` +Access-Control-Allow-Headers: sentry-trace, baggage, traceparent +``` + ## Disabling Trace Propagation If you want to disable distributed tracing entirely and ensure no trace headers are sent: