# Cloudflare: API origins and Workers There are two separate integrations: preserve browser context to an instrumented API behind Cloudflare, or export native Worker telemetry. The first gives browser-to-origin correlation when the forwarding path preserves W3C context. Native Worker export adds supported Worker data, with the propagation limitations below. Provider behavior was checked on **2026-09-28**. Workers traces and OpenTelemetry export are currently beta features, and native export requires a Workers Paid subscription or higher. Confirm availability and billing in your account before enabling it. ## Connect a proxied API origin You need a working HTTPS origin, permission to edit the zone's relevant cache/header rules, and an instrumented application with HTTPS egress to Corridora. Follow the [language setup](../README.md) and [host](../backend/infrastructure/hosts.md) or [Docker guide](../backend/infrastructure/docker.md). Configure the origin SDK with the common [cloud export settings](README.md#shared-export-settings). Keep the backend key in the origin's secret store. The API can use a proxied hostname without a Worker handling the request. Install [browser RUM](../../browser-rum.md) in the Pages or Workers static-assets frontend. For a separate API hostname, use: ```html data-trace-origins="https://api.example.com" ``` Keep the complete generated script tag's key, endpoint, and CSP settings. The API must allow `traceparent` in CORS preflights when the request is cross-origin. ## Keep API requests uncached and preserve headers Create an applicable Cache Rule for the API, for example: ```text Expression: (http.host eq "api.example.com" and starts_with(http.request.uri.path, "/api/")) Cache eligibility: Bypass cache ``` Check effective rule order against other cache settings. In request-header Transform Rules, Origin Rules, gateways, and any Worker on the route, preserve `traceparent` rather than removing it or replacing it with a fixed value. Preserve `tracestate` between trusted server services where used; the Corridora browser injector sends only `traceparent`. Allow the application's legitimate requests and preflights through its WAF and access policies. Forwarding context does not add a CDN span. Cache hits and edge-generated responses do not create origin spans when no origin request occurs. ## Export native Worker traces and logs For an existing Worker, you need permission to manage account observability destinations and deploy the Worker. Native export supports OTLP JSON traces and logs; metrics export is not currently supported. In the account dashboard, open **Observability → Destinations**, select **Add destination**, and create each destination below. Set its name, signal type, OTLP endpoint, and custom authentication header, then select **Save**. See [Cloudflare's OpenTelemetry export instructions](https://developers.cloudflare.com/observability/export/opentelemetry/). | Name | Type | OTLP endpoint | Custom header | | --- | --- | --- | --- | | `corridora-traces` | Traces | `https://ingest.corridora.ai/v1/traces` | `X-CORRIDORA-KEY: YOUR_BACKEND_INGEST_KEY` | | `corridora-logs` | Logs | `https://ingest.corridora.ai/v1/logs` | `X-CORRIDORA-KEY: YOUR_BACKEND_INGEST_KEY` | Use your installation's hosts if different. Store credentials in these destination settings, not Worker source or Wrangler `vars`. These are backend signals; do not add the browser `X-Corridora-Ingest-Source: rum` header. Cloudflare sends a verification export before saving a destination. Its [custom receiver requirements](https://developers.cloudflare.com/observability/export/opentelemetry/#custom-receiver-requirements) specify HTTP `200`, JSON content type, and an empty JSON object (`{}`) for success. Corridora's direct ingest handlers can return an empty `200` body. If destination verification rejects that response, use an authenticated OTLP/HTTP JSON [Collector gateway](../../../collector.md#choose-agent-or-gateway-placement) that returns the required response and forwards to Corridora. Point the destinations at that gateway's separate trace/log endpoints and use its intake authentication. The local unauthenticated Collector example must not be exposed as a public gateway unchanged. Merge the following into your Worker's existing `wrangler.jsonc`, keeping its existing entry point, bindings, and compatibility configuration: ```json { "observability": { "traces": { "enabled": true, "destinations": ["corridora-traces"], "head_sampling_rate": 1, "persist": false }, "logs": { "enabled": true, "destinations": ["corridora-logs"], "head_sampling_rate": 1, "persist": false } } } ``` This is a configuration fragment for an existing Worker, not a complete project. Destination names must match the account settings. Redeploy through the project's normal deployment process. `persist: false` selects external export without Cloudflare dashboard persistence for that signal; it does not prevent Corridora from retaining received data. Start with full sampling for the acceptance test, then choose the production rates deliberately. Check destination delivery status and allow time for asynchronous delivery. ## Native context limitations Cloudflare currently documents that native Worker trace context is not automatically propagated to external services. Enabling native export therefore does not establish a browser → Worker → non-Cloudflare backend trace. Verify incoming and outgoing context separately in the actual deployment. For the origin recipe, an uninstrumented forwarding hop can preserve the browser header unchanged. If you need a Worker to create a child span, use a Workers-compatible instrumentation design with explicit context extraction/injection and runtime-aware export; that is separate from this native-export recipe. Do not apply Node's auto-instrumentation preload to Workers or rewrite unrelated trace IDs to make spans appear connected. Native attribute coverage can differ by span, and the beta's span names may change. Inspect a received record's actual resource identity when selecting the service in Corridora. Do not assume a Worker name field in Cloudflare's own UI is a Corridora `service.name` resource attribute on every exported record. ## Verify both integrations 1. Through the proxied API route, make an uncached browser fetch after RUM starts. 2. Compare outgoing browser context, the origin's active trace, and stored Corridora spans using [verification](../verification.md). 3. For native Worker export, separately invoke the Worker and inspect destination delivery status, trace records, and a representative log in Corridora. 4. Test a Worker subrequest to the external origin before asserting parent/child continuity. Matching timing alone is insufficient. 5. After changing a destination key, confirm fresh delivery rather than relying on previously stored records. For failures, distinguish blocked page scripts, browser CORS, origin egress, native destination errors, and the documented propagation limitation. Use [missing-data troubleshooting](../../../troubleshoot/missing-data.md) after locating the failing stage.