Azure Application Insights adds a header (I think when distributedTracingMode is set to DistributedTracingModes.W3C) called “traceparent” and this causes the OPTIONS call to http://127.0.0.1:7242/ingest/ fail because that header is not allowed by the CORS policy.
Steps to Reproduce
Enable Application Insights with distributed tracing:
This looks like a valid issue with the CORS configuration of the local debug ingest endpoint. The “traceparent” header from Azure Application Insights isn’t allowed by the current CORS policy at http://127.0.0.1:7242/ingest/.
I’ll create a ticket for the engineering team to update the Debug Mode CORS policy to support standard W3C tracing headers.
Ran into the same issue with OpenTelemetry browser instrumentation:
Root cause: FetchInstrumentation adds traceparent headers to all fetch requests, including debug logs to ``http://127.0.0.1:7242``. That server doesn't allow traceparent in CORS, so the browser blocks the request.
The workaround for me was to add ignore patterns to my instrumentation config:
registerInstrumentations({
instrumentations: [
new FetchInstrumentation({
// Propagate trace context in fetch requests
propagateTraceHeaderCorsUrls: [
// Allow CORS trace propagation to backend
/.*/,
],
// Exclude debug logging endpoint from instrumentation to avoid CORS issues
// The debug endpoint doesn't support traceparent headers
ignoreUrls: [
/^http:\/\/127\.0\.0\.1:7242\/.*/,
/^http:\/\/localhost:7242\/.*/,
],
}),
new XMLHttpRequestInstrumentation({
// Propagate trace context in XMLHttpRequest (used by EventSource/SSE)
propagateTraceHeaderCorsUrls: [
/.*/,
],
// Exclude debug logging endpoint from instrumentation
ignoreUrls: [
/^http:\/\/127\.0\.0\.1:7242\/.*/,
/^http:\/\/localhost:7242\/.*/,
],
}),
new UserInteractionInstrumentation({
// Automatically instrument user interactions (clicks, form submissions, etc.)
}),
],
});