Skip to main content

How do I route SDK traffic through a custom domain instead of sentry.io?

Issue

We want to proxy requests from our SDK through our own domain before they reach Sentry, instead of sending them directly to sentry.io. We need to know which options Sentry supports for routing SDK traffic through a custom domain.

Applies To

  • All SaaS Customers and Self-Hosted Users

  • SDK Configuration

  • Relay / Enterprise Domain Management

  • Organizations that need a custom domain for Sentry traffic

Resolution

Sentry supports two ways to route SDK traffic through your own domain: SDK tunneling and Relay. Choose based on your needs.

  • SDK tunneling: Some SDKs, primarily the browser and JavaScript SDKs, support a tunnel option that sets the URL used to transport captured events. This points the SDK at an endpoint on your own domain instead of sentry.io. You must implement the custom server endpoint yourself; it receives the event envelopes and forwards them to Sentry, and your DSN is still required so Sentry can set the necessary attributes. This approach is most common for working around ad-blockers. Check your SDK's documentation for availability, and see the tunnel option reference and the Dealing with Ad-Blockers guide for examples.

  • Relay: Relay is a standalone service that acts as a middle layer between your application and sentry.io. You point your SDK's DSN at your Relay host, and Relay forwards events to Sentry. Relay is designed for enterprise domain management, so it is the right choice when you must restrict all HTTP communication to a custom domain, or when you also want centralized PII scrubbing or improved response times. For forwarding with minimal processing, run Relay in proxy mode.

If you only need to hide Sentry traffic behind your own domain in a browser app, use SDK tunneling. If you have enterprise requirements to keep all traffic on a custom domain or to scrub data centrally, use Relay.

Did this answer your question?