> ## Documentation Index
> Fetch the complete documentation index at: https://launchdarkly.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Service endpoint configuration

<View title="Developer" />

<View title="Federal docs" />

<View title="EU docs" />

This topic explains how to configure LaunchDarkly SDKs to connect to alternate service endpoints.

Each SDK connects to several LaunchDarkly web services. These include services for getting feature flag data using streaming or polling, and a service for storing analytics events. Optionally, you can configure LaunchDarkly to connect to alternate service endpoints.

Most customers do not need to configure service endpoints. You may need to configure service endpoints in the following situations:

* You are working with the LaunchDarkly federal instance. If you are using the [federal instance of LaunchDarkly](/docs/home/infrastructure/federal), you must configure the SDK so that it connects to the federal instance for these services instead.
* You are working with the LaunchDarkly European Union (EU) instance. If you are using the EU instance of LaunchDarkly, you must configure the SDK so that it connects to the federal instance for these services instead. To learn which URLs to use instead, read the [EU instance documentation](/docs/home/infrastructure/eu).
* You are using the Relay Proxy in proxy mode. To learn more, read [Using proxy mode](/docs/sdk/features/relay-proxy-configuration/proxy-mode).
* You are using the [LaunchDarkly CLI](/docs/home/getting-started/ldcli) to run a local `dev-server` for testing, and you want to access local flag values from there. To learn more, read [Using the LaunchDarkly CLI for local testing](/docs/guides/flags/ldcli-dev-server).

The examples below show how to configure the SDK for each service. In most SDKs, you then need to pass the configuration in as a parameter when you initialize the client. To learn more, read [SDK configuration](/docs/sdk/features/config).

Details about each SDK's configuration are available in the SDK-specific sections below:

* [Client-side SDKs](#client-side-sdks)
* [Server-side SDKs](#server-side-sdks)

## Client-side SDKs

This feature is available in the following client-side SDKs:

* [.NET (client-side)](#net-client-side)
* [Android](#android)
* [C++ (client-side)](#c++-client-side)
* [Electron](#electron)
* [Flutter](#flutter)
* [iOS](#ios)
* [JavaScript](#javascript)
* [Node.js (client-side)](#node-js-client-side)
* [React Native](#react-native)
* [React Web](#react-web)
* [Roku](#roku)
* [Vue](#vue)

### .NET (client-side)

<Accordion title="Expand .NET (client-side) code sample">
  To configure an alternate service endpoint for the SDK, use the `ServiceEndpoints` builder method to specify the base URIs. Here are some examples for common base URIs that you might use instead of the defaults:

  <CodeGroup>
    ```csharp title="C#, connecting to Relay Proxy" lines wrap theme={null}
    var config = Configuration
        .Builder("example-mobile-key", ConfigurationBuilder.AutoEnvAttributes.Enabled)
        .ServiceEndpoints(Components.ServiceEndpoints()
          .RelayProxy("https://your-relay-proxy.com:8030"))
        .Build();
    ```

    ```csharp title="C#, connecting to federal instance" lines wrap theme={null}
    var config = Configuration
        .Builder("example-mobile-key", ConfigurationBuilder.AutoEnvAttributes.Enabled)
        .ServiceEndpoints(Components.ServiceEndpoints()
          .Streaming("https://clientstream.launchdarkly.us")
          .Polling("https://clientsdk.launchdarkly.us")
          .Events("https://events.launchdarkly.us"))
        .Build();
    ```

    ```csharp title="C#, connecting to EU instance" lines wrap theme={null}
    var config = Configuration
        .Builder("example-mobile-key", ConfigurationBuilder.AutoEnvAttributes.Enabled)
        .ServiceEndpoints(Components.ServiceEndpoints()
          .Streaming("https://clientstream.eu.launchdarkly.com")
          .Polling("https://clientsdk.eu.launchdarkly.com")
          .Events("https://events.eu.launchdarkly.com"))
        .Build();
    ```
  </CodeGroup>
</Accordion>

### Android

<Accordion title="Expand Android code sample">
  To configure an alternate service endpoint for the SDK, use the `streamUri`, `pollUri`, and `eventsUri` builder methods to specify the base URIs. Here are some examples for common base URIs that you might use instead of the defaults:

  <CodeGroup>
    ```java title="Java, connecting to Relay Proxy" lines wrap theme={null}
    LDConfig ldConfig = new LDConfig.Builder(AutoEnvAttributes.Enabled)
      .mobileKey("example-mobile-key")
      .serviceEndpoints(
        Components.serviceEndpoints()
          .relayProxy("https://your-relay-proxy.com:8030")
      )
      .build();
    ```

    ```java title="Java, connecting to federal instance" lines wrap theme={null}
    LDConfig ldConfig = new LDConfig.Builder(AutoEnvAttributes.Enabled)
      .mobileKey("example-mobile-key")
      .serviceEndpoints(
        Components.serviceEndpoints()
          .streaming("https://clientstream.launchdarkly.us")
          .polling("https://clientsdk.launchdarkly.us")
          .events("https://events.launchdarkly.us")
      )
      .build();
    ```

    ```java title="Java, connecting to EU instance" lines wrap theme={null}
    LDConfig ldConfig = new LDConfig.Builder(AutoEnvAttributes.Enabled)
      .mobileKey("example-mobile-key")
      .serviceEndpoints(
        Components.serviceEndpoints()
          .streaming("https://clientstream.eu.launchdarkly.com")
          .polling("https://clientsdk.eu.launchdarkly.com")
          .events("https://events.eu.launchdarkly.com")
      )
      .build();
    ```

    ```kotlin title="Kotlin, connecting to Relay Proxy" lines wrap theme={null}
    val ldConfig: LDConfig = LDConfig.Builder(AutoEnvAttributes.Enabled)
      .mobileKey("example-mobile-key")
      .serviceEndpoints(
        Components.serviceEndpoints()
          .relayProxy("https://your-relay-proxy.com:8030")
      )
      .build();
    ```

    ```kotlin title="Kotlin, connecting to federal instance" lines wrap theme={null}
    val ldConfig: LDConfig = LDConfig.Builder(AutoEnvAttributes.Enabled)
      .mobileKey("example-mobile-key")
      .serviceEndpoints(
        Components.serviceEndpoints()
          .streaming("https://clientstream.launchdarkly.us")
          .polling("https://clientsdk.launchdarkly.us")
          .events("https://events.launchdarkly.us")
      )
      .build();
    ```

    ```kotlin title="Kotlin, connecting to EU instance" lines wrap theme={null}
    val ldConfig: LDConfig = LDConfig.Builder(AutoEnvAttributes.Enabled)
      .mobileKey("example-mobile-key")
      .serviceEndpoints(
        Components.serviceEndpoints()
          .streaming("https://clientstream.eu.launchdarkly.com")
          .polling("https://clientsdk.eu.launchdarkly.com")
          .events("https://events.eu.launchdarkly.com")
      )
      .build();
    ```
  </CodeGroup>
</Accordion>

### C++ (client-side)

<Accordion title="Expand C++ (client-side) code sample">
  To configure an alternate service endpoint for the SDK, use `StreamingBaseUrl`, `PollingBaseUrl`, and `EventsBaseUrl` to specify the base URIs. Here are some examples for common base URIs that you might use instead of the defaults:

  <CodeGroup>
    ```cpp title="C++ SDK v3.0 (native), connecting to Relay Proxy" lines wrap theme={null}
    auto config_builder = client_side::ConfigBuilder("example-mobile-key");
    config_builder.ServiceEndpoints()
        .StreamingBaseUrl("https://your-relay-proxy.com:8030")
        .PollingBaseUrl("https://your-relay-proxy.com:8030")
        .EventsBaseUrl("https://your-relay-proxy.com:8030");
    auto config = config_builder.Build();
    ```

    ```c title="C++ SDK v3.0 (C binding), connecting to Relay Proxy" lines wrap theme={null}
    LDClientConfigBuilder builder = LDClientConfigBuilder_New("example-mobile-key");
    LDClientConfigBuilder_ServiceEndpoints_StreamingBaseURL(builder, "https://your-relay-proxy.com:8030");
    LDClientConfigBuilder_ServiceEndpoints_PollingBaseURL(builder, "https://your-relay-proxy.com:8030");
    LDClientConfigBuilder_ServiceEndpoints_EventsBaseURL(builder, "https://your-relay-proxy.com:8030");
    LDClientConfig config;

    LDStatus status = LDClientConfigBuilder_Build(builder, &config);

    if (!LDStatus_Ok(status)) {
        /* an error occurred, config is not valid */
    }
    ```

    ```cpp title="C++ SDK v3.0 (native), connecting to federal instance" lines wrap theme={null}
    auto config_builder = client_side::ConfigBuilder("example-mobile-key");
    config_builder.ServiceEndpoints()
        .StreamingBaseUrl("https://clientstream.launchdarkly.us")
        .PollingBaseUrl("https://clientsdk.launchdarkly.us")
        .EventsBaseUrl("https://events.launchdarkly.us");
    auto config = config_builder.Build();
    ```

    ```c title="C++ SDK v3.0 (C binding), connecting to federal instance" lines wrap theme={null}
    LDClientConfigBuilder builder = LDClientConfigBuilder_New("example-mobile-key");
    LDClientConfigBuilder_ServiceEndpoints_StreamingBaseURL(builder, "https://clientstream.launchdarkly.us");
    LDClientConfigBuilder_ServiceEndpoints_PollingBaseURL(builder, "https://clientsdk.launchdarkly.us");
    LDClientConfigBuilder_ServiceEndpoints_EventsBaseURL(builder, "https://events.launchdarkly.us");
    LDClientConfig config;

    LDStatus status = LDClientConfigBuilder_Build(builder, &config);

    if (!LDStatus_Ok(status)) {
        /* an error occurred, config is not valid */
    }
    ```

    ```cpp title="C++ SDK v3.0 (native), connecting to EU instance" lines wrap theme={null}
    auto config_builder = client_side::ConfigBuilder("example-mobile-key");
    config_builder.ServiceEndpoints()
        .StreamingBaseUrl("https://clientstream.eu.launchdarkly.com")
        .PollingBaseUrl("https://clientsdk.eu.launchdarkly.com")
        .EventsBaseUrl("https://events.eu.launchdarkly.com");
    auto config = config_builder.Build();
    ```

    ```c title="C++ SDK v3.0 (C binding), connecting to EU instance" lines wrap theme={null}
    LDClientConfigBuilder builder = LDClientConfigBuilder_New("example-mobile-key");
    LDClientConfigBuilder_ServiceEndpoints_StreamingBaseURL(builder, "https://clientstream.eu.launchdarkly.com");
    LDClientConfigBuilder_ServiceEndpoints_PollingBaseURL(builder, "https://clientsdk.eu.launchdarkly.com");
    LDClientConfigBuilder_ServiceEndpoints_EventsBaseURL(builder, "https://events.eu.launchdarkly.com");
    LDClientConfig config;

    LDStatus status = LDClientConfigBuilder_Build(builder, &config);

    if (!LDStatus_Ok(status)) {
        /* an error occurred, config is not valid */
    }
    ```
  </CodeGroup>

  To learn more, read [`ServiceEndpoints`](https://launchdarkly.github.io/cpp-sdks/libs/client-sdk/docs/html/classlaunchdarkly_1_1config_1_1shared_1_1builders_1_1ConfigBuilder.html#ae28867ba563432a91f355d04f45daec2).
</Accordion>

### Electron

<Accordion title="Expand Electron code sample">
  To configure an alternate service endpoint for the SDK, use the `streamUrl`, `baseUrl`, and `eventsUrl` options to specify the base URIs. Here are some examples for common base URIs that you might use instead of the defaults:

  <CodeGroup>
    ```js title="JavaScript, connecting to Relay Proxy" lines wrap theme={null}
    const options = {
      streamUrl: 'https://your-relay-proxy.com:8030',
      baseUrl: 'https://your-relay-proxy.com:8030',
      eventsUrl: 'https://your-relay-proxy.com:8030'
    };
    ```

    ```ts title="TypeScript, connecting to Relay Proxy" lines wrap theme={null}
    import * as LDElectron from 'launchdarkly-electron-client-sdk';

    const options: LDElectron.LDOptions = {
      streamUrl: 'https://your-relay-proxy.com:8030',
      baseUrl: 'https://your-relay-proxy.com:8030',
      eventsUrl: 'https://your-relay-proxy.com:8030',
    };
    ```

    ```js title="JavaScript, connecting to federal instance" lines wrap theme={null}
    const options = {
      streamUrl: 'https://clientstream.launchdarkly.us',
      baseUrl: 'https://clientsdk.launchdarkly.us',
      eventsUrl: 'https://events.launchdarkly.us'
    };
    ```

    ```ts title="TypeScript, connecting to federal instance" lines wrap theme={null}
    import * as LDElectron from 'launchdarkly-electron-client-sdk';

    const options: LDElectron.LDOptions = {
      streamUrl: 'https://clientstream.launchdarkly.us',
      baseUrl: 'https://clientsdk.launchdarkly.us',
      eventsUrl: 'https://events.launchdarkly.us'
    };
    ```

    ```js title="JavaScript, connecting to EU instance" lines wrap theme={null}
    const options = {
      streamUrl: 'https://clientstream.eu.launchdarkly.com',
      baseUrl: 'https://clientsdk.eu.launchdarkly.com',
      eventsUrl: 'https://events.eu.launchdarkly.com'
    };
    ```

    ```ts title="TypeScript, connecting to EU instance" lines wrap theme={null}
    import * as LDElectron from 'launchdarkly-electron-client-sdk';

    const options: LDElectron.LDOptions = {
      streamUrl: 'https://clientstream.eu.launchdarkly.com',
      baseUrl: 'https://clientsdk.eu.launchdarkly.com',
      eventsUrl: 'https://events.eu.launchdarkly.com'
    };
    ```
  </CodeGroup>

  The Electron SDK uses the `baseUrl` for the initial connection and subsequent `identify` calls.

  If you have enabled [streaming](https://launchdarkly.github.io/electron-client-sdk/interfaces/_launchdarkly_electron_client_sdk_.ldoptions.html#streaming), the SDK uses the `streamUrl` for subsequent connections. If you have enabled [`useReport`](https://launchdarkly.github.io/electron-client-sdk/interfaces/_launchdarkly_electron_client_sdk_.ldoptions.html#usereport), these subsequent requests will use the `REPORT` HTTP request method. These REPORT requests are streaming requests only if you have installed the [LaunchDarkly EventSource polyfill](https://github.com/launchdarkly/js-eventsource) to provide streaming support. Otherwise, these requests will be standard `REPORT` http requests. To learn more, read [EventSource](/docs/sdk/client-side/javascript/requirements-polyfills#eventsource) under [Requirements and polyfills](/docs/sdk/client-side/javascript/requirements-polyfills).
</Accordion>

### Flutter

<Accordion title="Expand Flutter code sample">
  To configure an alternate service endpoint for the SDK, use the `ServiceEndpoints` configuration option to specify the base URIs. Here are some examples for common base URIs that you might use instead of the defaults:

  <CodeGroup>
    ```dart title="Flutter SDK v4, connecting to Relay Proxy" lines wrap theme={null}
    final config = LDConfig(
      CredentialSource.fromEnvironment(),
      AutoEnvAttributes.enabled,
      serviceEndpoints: ServiceEndpoints.relayProxy('https://your-relay-proxy.com:8030')
    );
    ```

    ```dart title="Flutter SDK v4, connecting to federal instance" lines wrap theme={null}
    final config = LDConfig(
      CredentialSource.fromEnvironment(),
      AutoEnvAttributes.enabled,
      serviceEndpoints: ServiceEndpoints.custom(
        streaming: 'https://clientstream.launchdarkly.us',
        polling: 'https://clientsdk.launchdarkly.us',
        events: 'https://events.launchdarkly.us',
      )
    );
    ```

    ```dart title="Flutter SDK v4, connecting to EU instance" lines wrap theme={null}
    final config = LDConfig(
      CredentialSource.fromEnvironment(),
      AutoEnvAttributes.enabled,
      serviceEndpoints: ServiceEndpoints.custom(
        streaming: 'https://clientstream.eu.launchdarkly.com',
        polling: 'https://clientsdk.eu.launchdarkly.com',
        events: 'https://events.eu.launchdarkly.com',
      )
    );
    ```
  </CodeGroup>

  To learn more, read [`serviceEndpoints`](https://pub.dev/documentation/launchdarkly_flutter_client_sdk/latest/launchdarkly_flutter_client_sdk/LDConfig/serviceEndpoints.html).
</Accordion>

### iOS

<Accordion title="Expand iOS code sample">
  To configure an alternate service endpoint for the SDK, use the `streamUrl`, `baseUrl`, and `eventsUrl` properties to specify the base URIs. Here are some examples for common base URIs that you might use instead of the defaults:

  <CodeGroup>
    ```swift title="Swift, connecting to Relay Proxy" lines wrap theme={null}
    var ldConfig = LDConfig(mobileKey: "example-mobile-key", autoEnvAttributes: .enabled)
    ldConfig.streamUrl = URL(string: "https://your-relay-proxy.com:8030")
    ldConfig.baseUrl = URL(string: "https://your-relay-proxy.com:8030")
    ldConfig.eventsUrl = URL(string: "https://your-relay-proxy.com:8030")
    ```

    ```objectivec title="Objective-C, connecting to Relay Proxy" lines wrap theme={null}
    LDConfig *ldConfig = [[LDConfig alloc] initWithMobileKey:@"example-mobile-key" autoEnvAttributes:AutoEnvAttributesEnabled];
    ldConfig.streamUrl = [NSURL URLWithString:@"https://your-relay-proxy.com:8030"];
    ldConfig.baseUrl = [NSURL URLWithString:@"https://your-relay-proxy.com:8030"];
    ldConfig.eventsUrl = [NSURL URLWithString:@"https://your-relay-proxy.com:8030"];
    ```

    ```swift title="Swift, connecting to federal instance" lines wrap theme={null}
    var ldConfig = LDConfig(mobileKey: "example-mobile-key", autoEnvAttributes: .enabled)
    ldConfig.streamUrl = URL(string: "https://clientstream.launchdarkly.us")
    ldConfig.baseUrl = URL(string: "https://clientsdk.launchdarkly.us")
    ldConfig.eventsUrl = URL(string: "https://events.launchdarkly.us")
    ```

    ```objectivec title="Objective-C, connecting to federal instance" lines wrap theme={null}
    LDConfig *ldConfig = [[LDConfig alloc] initWithMobileKey:@"example-mobile-key" autoEnvAttributes:AutoEnvAttributesEnabled];
    ldConfig.streamUrl = [NSURL URLWithString:@"https://clientstream.launchdarkly.us"];
    ldConfig.baseUrl = [NSURL URLWithString:@"https://clientsdk.launchdarkly.us"];
    ldConfig.eventsUrl = [NSURL URLWithString:@"https://events.launchdarkly.us"];
    ```

    ```swift title="Swift, connecting to EU instance" lines wrap theme={null}
    var ldConfig = LDConfig(mobileKey: "example-mobile-key", autoEnvAttributes: .enabled)
    ldConfig.streamUrl = URL(string: "https://clientstream.eu.launchdarkly.com")
    ldConfig.baseUrl = URL(string: "https://clientsdk.eu.launchdarkly.com")
    ldConfig.eventsUrl = URL(string: "https://events.eu.launchdarkly.com")
    ```

    ```objectivec title="Objective-C, connecting to EU instance" lines wrap theme={null}
    LDConfig *ldConfig = [[LDConfig alloc] initWithMobileKey:@"example-mobile-key" autoEnvAttributes:AutoEnvAttributesEnabled];
    ldConfig.streamUrl = [NSURL URLWithString:@"https://clientstream.eu.launchdarkly.com"];
    ldConfig.baseUrl = [NSURL URLWithString:@"https://clientsdk.eu.launchdarkly.com"];
    ldConfig.eventsUrl = [NSURL URLWithString:@"https://events.eu.launchdarkly.com"];
    ```
  </CodeGroup>

  <Warning>
    **Relay Proxy compatibility with event payload compression**

    If you are using LaunchDarkly iOS SDK version 9.9 or greater and you choose to enable compression of event payloads, you **must** upgrade Relay Proxy to version 8.9 or greater. To learn more, read [`enableCompression`](https://launchdarkly.github.io/ios-client-sdk/Structs/LDConfig.html#/s:12LaunchDarkly8LDConfigV17enableCompressionSbvp) and [Configuring an SDK to use the Relay Proxy](/docs/sdk/features/relay-proxy-configuration#configuring-an-sdk-to-use-the-relay-proxy).
  </Warning>
</Accordion>

### JavaScript

<Accordion title="Expand JavaScript code sample">
  To configure an alternate service endpoint for the SDK, use the `streamUri`, `baseUri`, and `eventsUri` properties to specify the base URIs. In previous versions of the JavaScript SDK, these properties were named `streamUrl`, `baseUrl`, and `eventsUrl`, respectively.

  Here are some examples for common base URIs that you might use instead of the defaults:

  <CodeGroup>
    ```js title="Connect to Relay Proxy, JS SDK v4.x" lines wrap theme={null}
    const options = {
    streamUri: 'https://your-relay-proxy.com:8030',
    baseUri: 'https://your-relay-proxy.com:8030',
    eventsUri: 'https://your-relay-proxy.com:8030'
    };
    ```

    ```js title="Connect to Relay Proxy, JS SDK v3.x" lines wrap theme={null}
    const options = {
    streamUrl: 'https://your-relay-proxy.com:8030',
    baseUrl: 'https://your-relay-proxy.com:8030',
    eventsUrl: 'https://your-relay-proxy.com:8030'
    };
    ```

    ```js title="Connect to federal instance, JS SDK v4.x" lines wrap theme={null}
    const options = {
    streamUri: 'https://clientstream.launchdarkly.us',
    baseUri: 'https://clientsdk.launchdarkly.us',
    eventsUri: 'https://events.launchdarkly.us'
    };
    ```

    ```js title="Connect to federal instance, JS SDK v3.x" lines wrap theme={null}
    const options = {
    streamUrl: 'https://clientstream.launchdarkly.us',
    baseUrl: 'https://clientsdk.launchdarkly.us',
    eventsUrl: 'https://events.launchdarkly.us'
    };
    ```

    ```js title="Connect to EU instance, JS SDK v4.x" lines wrap theme={null}
    const options = {
    streamUri: 'https://clientstream.eu.launchdarkly.com',
    baseUri: 'https://clientsdk.eu.launchdarkly.com',
    eventsUri: 'https://events.eu.launchdarkly.com'
    };
    ```

    ```js title="Connect to EU instance, JS SDK v3.x" lines wrap theme={null}
    const options = {
    streamUrl: 'https://clientstream.eu.launchdarkly.com',
    baseUrl: 'https://clientsdk.eu.launchdarkly.com',
    eventsUrl: 'https://events.eu.launchdarkly.com'
    };
    ```
  </CodeGroup>

  The JavaScript SDK uses the `baseUri` for the initial connection and subsequent `identify` calls.

  If you have enabled [streaming](/docs/sdk/client-side/javascript#subscribe-to-flag-changes), the SDK uses the `streamUri` for subsequent connections. If you have enabled [`useReport`](https://launchdarkly.github.io/js-core/packages/sdk/browser/docs/interfaces/LDOptions.html#useReport), these subsequent requests will use the `REPORT` HTTP request method. These REPORT requests are streaming requests only if you have installed the [LaunchDarkly EventSource polyfill](https://github.com/launchdarkly/js-eventsource) to provide streaming support. Otherwise, these requests will be standard `REPORT` http requests. To learn more, read [EventSource](/docs/sdk/client-side/javascript/requirements-polyfills#eventsource) under [Requirements and polyfills](/docs/sdk/client-side/javascript/requirements-polyfills).
</Accordion>

### Node.js (client-side)

<Accordion title="Expand Node.js (client-side) code sample">
  To configure an alternate service endpoint for the SDK, use the `streamUrl`, `baseUrl`, and `eventsUrl` properties to set the base URIs. Here are some examples for common base URIs that you might use instead of the defaults:

  <CodeGroup>
    ```js title="JavaScript, connecting to Relay Proxy" lines wrap theme={null}
    const options = {
      streamUrl: 'https://your-relay-proxy.com:8030',
      baseUrl: 'https://your-relay-proxy.com:8030',
      eventsUrl: 'https://your-relay-proxy.com:8030'
    };
    ```

    ```ts title="TypeScript, connecting to Relay Proxy" lines wrap theme={null}
    import * as ld from 'launchdarkly-node-client-sdk';

    const options: ld.LDOptions = {
      streamUrl: 'https://your-relay-proxy.com:8030',
      baseUrl: 'https://your-relay-proxy.com:8030',
      eventsUrl: 'https://your-relay-proxy.com:8030',
    };
    ```

    ```js title="JavaScript, connecting to federal instance" lines wrap theme={null}
    const options = {
      streamUrl: 'https://clientstream.launchdarkly.us',
      baseUrl: 'https://clientsdk.launchdarkly.us',
      eventsUrl: 'https://events.launchdarkly.us'
    };

    ```

    ```ts title="TypeScript, connecting to federal instance" lines wrap theme={null}
    import * as ld from 'launchdarkly-node-client-sdk';

    const options: ld.LDOptions = {
      streamUrl: 'https://clientstream.launchdarkly.us',
      baseUrl: 'https://clientsdk.launchdarkly.us',
      eventsUrl: 'https://events.launchdarkly.us',
    };
    ```

    ```js title="JavaScript, connecting to EU instance" lines wrap theme={null}
    const options = {
      streamUrl: 'https://clientstream.eu.launchdarkly.com',
      baseUrl: 'https://clientsdk.eu.launchdarkly.com',
      eventsUrl: 'https://events.eu.launchdarkly.com'
    };

    ```

    ```ts title="TypeScript, connecting to EU instance" lines wrap theme={null}
    import * as ld from 'launchdarkly-node-client-sdk';

    const options: ld.LDOptions = {
      streamUrl: 'https://clientstream.eu.launchdarkly.com',
      baseUrl: 'https://clientsdk.eu.launchdarkly.com',
      eventsUrl: 'https://events.eu.launchdarkly.com',
    };
    ```
  </CodeGroup>

  The Node.js (client-side) SDK uses the `baseUrl` for the initial connection and subsequent `identify` calls.

  If you have enabled [streaming](/docs/sdk/client-side/node-js#subscribe-to-flag-changes), the SDK uses the `streamUrl` for subsequent connections. If you have enabled [`useReport`](https://launchdarkly.github.io/node-client-sdk/interfaces/LDOptions.html#useReport), these subsequent requests will use the `REPORT` HTTP request method. These REPORT requests are streaming requests only if you have installed the [LaunchDarkly EventSource polyfill](https://github.com/launchdarkly/js-eventsource) to provide streaming support. Otherwise, these requests will be standard `REPORT` http requests. To learn more, read [EventSource](/docs/sdk/client-side/javascript/requirements-polyfills#eventsource) under [Requirements and polyfills](/docs/sdk/client-side/javascript/requirements-polyfills).
</Accordion>

### React Native

<Accordion title="Expand React Native code sample">
  To configure an alternate service endpoint for the SDK, use the `streamUri`, `baseUri`, and `eventsUri` properties to set the base URIs. Here are some examples for common base URIs that you might use instead of the defaults:

  <CodeGroup>
    ```ts title="React Native SDK v10, connecting to Relay Proxy" lines wrap theme={null}
    import { LDOptions } from '@launchdarkly/react-native-client-sdk'

    let options: LDOptions = {
      streamUri: 'https://your-relay-proxy.com:8030',
      baseUri: 'https://your-relay-proxy.com:8030',
      eventsUri: 'https://your-relay-proxy.com:8030',
    };
    ```

    ```ts title="React Native SDK v10, connecting to federal instance" lines wrap theme={null}
    import { LDOptions } from '@launchdarkly/react-native-client-sdk'

    let options: LDOptions = {
      streamUri: 'https://clientstream.launchdarkly.us',
      baseUri: 'https://clientsdk.launchdarkly.us',
      eventsUri: 'https://events.launchdarkly.us',
    };
    ```

    ```ts title="React Native SDK v10, connecting to EU instance" lines wrap theme={null}
    import { LDOptions } from '@launchdarkly/react-native-client-sdk'

    let options: LDOptions = {
      streamUri: 'https://clientstream.eu.launchdarkly.com',
      baseUri: 'https://clientsdk.eu.launchdarkly.com',
      eventsUri: 'https://events.eu.launchdarkly.com',
    };
    ```
  </CodeGroup>

  In version 6.x and earlier, the config properties were named `streamUri`, `pollUri`, and `eventsUri`. They were renamed to `streamUrl`, `pollUrl`, and `eventsUrl` in version 7.0. In version 10.0, they are named `streamUri`, `baseUri`, and `eventsUri`. To learn more, read [`LDOptions`](https://launchdarkly.github.io/js-core/packages/sdk/react-native/docs/index.html#LDOptions).
</Accordion>

### React Web

<Accordion title="Expand React Web code sample">
  To configure an alternate service endpoint for the SDK, use the `streamUrl`, `baseUrl`, and `eventsUrl` options to specify the base URIs. Here are some examples for common base URIs that you might use instead of the defaults:

  <CodeGroup>
    ```js title="JavaScript, connecting to Relay Proxy" lines wrap theme={null}
    const options = {
      baseUrl: 'https://your-relay-proxy.com:8030',
      streamUrl: 'https://your-relay-proxy.com:8030',
      eventsUrl: 'https://your-relay-proxy.com:8030'
    };
    ```

    ```js title="JavaScript, connecting to federal instance" lines wrap theme={null}
    const options = {
      baseUrl:"https://clientsdk.launchdarkly.us",
      streamUrl:"https://clientstream.launchdarkly.us",
      eventsUrl:"https://events.launchdarkly.us"
    };
    ```

    ```js title="JavaScript, connecting to EU instance" lines wrap theme={null}
    const options = {
      baseUrl:"https://clientsdk.eu.launchdarkly.com",
      streamUrl:"https://clientstream.eu.launchdarkly.com",
      eventsUrl:"https://events.eu.launchdarkly.com"
    };
    ```
  </CodeGroup>

  The React Web SDK uses the `baseUrl` for the initial connection and subsequent `identify` calls.

  If you have enabled [streaming](/docs/sdk/client-side/react/react-web#subscribe-to-flag-changes), the SDK uses the `streamUrl` for subsequent connections. If you have enabled [`useReport`](https://launchdarkly.github.io/node-client-sdk/interfaces/LDOptions.html#useReport), these subsequent requests will use the `REPORT` HTTP request method. These REPORT requests are streaming requests only if you have installed the [LaunchDarkly EventSource polyfill](https://github.com/launchdarkly/js-eventsource) to provide streaming support. Otherwise, these requests will be standard `REPORT` http requests. To learn more, read [EventSource](/docs/sdk/client-side/javascript/requirements-polyfills#eventsource) under [Requirements and polyfills](/docs/sdk/client-side/javascript/requirements-polyfills).

  To learn more, read [Configuration options](/docs/sdk/client-side/react/react-web#configuration-options) in the [React Web SDK reference](/docs/sdk/client-side/react/react-web).
</Accordion>

### Roku

<Accordion title="Expand Roku code sample">
  <View title="Federal docs">
    <Danger>
      **The Roku SDK is not supported in the federal instance of LaunchDarkly**

      The Roku SDK supports service endpoint configuration. However, you should use this feature when working with the Relay Proxy only. The Roku SDK is not supported in the federal instance of LaunchDarkly. To learn more, read <a href="/docs/home/infrastructure/federal">LaunchDarkly in federal environments</a>.
    </Danger>
  </View>

  <View title="EU docs">
    <Danger>
      **The Roku SDK is not supported in the EU instance of LaunchDarkly**

      The Roku SDK supports service endpoint configuration. However, you should use this feature when working with the Relay Proxy only. The Roku SDK is not supported in the EU instance of LaunchDarkly. To learn more, read <a href="/docs/home/infrastructure/eu">LaunchDarkly in the European Union (EU)</a>.
    </Danger>
  </View>

  To configure an alternate service endpoint for the SDK, use the `setStreamURI`, `setAppURI`, and `setEventsURI` methods to specify the base URIs:

  <CodeGroup>
    ```brightscript title="BrightScript, connecting to Relay Proxy" lines wrap theme={null}
    ' for a legacy Roku application
    config = LaunchDarklyConfig("example-mobile-key")

    ' for a SceneGraph Roku Application
    config = LaunchDarklyConfig("example-mobile-key", CLIENT_SCENEGRAPH_NODE)

    config.setStreamURI("https://your-relay-proxy.com:8030")
    config.setAppURI("https://your-relay-proxy.com:8030")
    config.setEventsURI("https://your-relay-proxy.com:8030")
    ```
  </CodeGroup>
</Accordion>

### Vue

<Accordion title="Expand Vue code sample">
  To configure an alternate service endpoint for the SDK, use the `streamUrl`, `baseUrl`, and `eventsUrl` options to specify the base URIs. Here are some examples for common base URIs that you might use instead of the defaults:

  <CodeGroup>
    ```js title="JavaScript, connecting to Relay Proxy" lines wrap theme={null}
    const options = {
      baseUrl: 'https://your-relay-proxy.com:8030',
      streamUrl: 'https://your-relay-proxy.com:8030',
      eventsUrl: 'https://your-relay-proxy.com:8030'
    };
    ```

    ```js title="JavaScript, connecting to federal instance" lines wrap theme={null}
    const options = {
      baseUrl:"https://clientsdk.launchdarkly.us",
      streamUrl:"https://clientstream.launchdarkly.us",
      eventsUrl:"https://events.launchdarkly.us"
    };
    ```

    ```js title="JavaScript, connecting to EU instance" lines wrap theme={null}
    const options = {
      baseUrl:"https://clientsdk.eu.launchdarkly.com",
      streamUrl:"https://clientstream.eu.launchdarkly.com",
      eventsUrl:"https://events.eu.launchdarkly.com"
    };
    ```
  </CodeGroup>
</Accordion>

## Server-side SDKs

This feature is available for the following server-side SDKs:

* [.NET (server-side)](#net-server-side)
* [Apex](#apex)
* [C++ (server-side)](#c++-server-side)
* [Erlang](#erlang)
* [Go](#go)
* [Haskell](#haskell)
* [Java](#java)
* [Lua](#lua)
* [Node.js (server-side)](#node-js-server-side)
* [PHP](#php)
* [Python](#python)
* [Ruby](#ruby)
* [Rust](#rust)

### .NET (server-side)

<Accordion title="Expand .NET (server-side) code sample">
  To configure an alternate service endpoint for the SDK, use the `ServiceEndpoints` builder method to specify the base URIs. Here are some examples for common base URIs that you might use instead of the defaults:

  <CodeGroup>
    ```csharp title="C#, connecting to Relay Proxy" lines wrap theme={null}
    var config = Configuration.Builder("YOUR_SDK_KEY")
        .ServiceEndpoints(Components.ServiceEndpoints()
          .RelayProxy("https://your-relay-proxy.com:8030"))
        .Build();
    ```

    ```csharp title="C#, connecting to federal instance" lines wrap theme={null}
    var config = Configuration.Builder("YOUR_SDK_KEY")
        .ServiceEndpoints(Components.ServiceEndpoints()
          .Streaming("https://stream.launchdarkly.us")
          .Polling("https://sdk.launchdarkly.us")
          .Events("https://events.launchdarkly.us"))
        .Build();
    ```

    ```csharp title="C#, connecting to EU instance" lines wrap theme={null}
    var config = Configuration.Builder("YOUR_SDK_KEY")
        .ServiceEndpoints(Components.ServiceEndpoints()
          .Streaming("https://stream.eu.launchdarkly.com")
          .Polling("https://sdk.eu.launchdarkly.com")
          .Events("https://events.eu.launchdarkly.com"))
        .Build();
    ```
  </CodeGroup>
</Accordion>

### Apex

<Accordion title="Expand Apex code sample">
  <View title="Federal docs">
    <Danger>
      **Federal customers should only use the Apex SDK with a FedRAMP-compliant database**

      The Apex SDK uses an external bridging application to connect LaunchDarkly and Salesforce. To ensure that your overall implementation is FedRAMP-compliant, you must run the Apex bridge within your own FedRAMP-compliant environment.
    </Danger>
  </View>

  First, set up the Apex bridge. If you are a federal customer, make sure you run the Apex bridge within your own FedRAMP-compliant environment. To learn more, read [Use the LaunchDarkly Salesforce bridge](/docs/sdk/server-side/apex#use-the-launchdarkly-salesforce-bridge).

  To configure an alternate service endpoint for the SDK, export the alternate URIs before you build the bridge:

  <CodeGroup>
    ```bash title="Console, connecting to federal instance" lines wrap theme={null}
    cd bridge && go build .

    # other required export statements...

    export LD_BASE_URI='https://sdk.launchdarkly.us'
    export LD_EVENTS_URL='https://events.launchdarkly.us'

    ./bridge
    ```

    ```bash title="Console, connecting to EU instance" lines wrap theme={null}
    cd bridge && go build .

    # other required export statements...

    export LD_BASE_URI='https://sdk.eu.launchdarkly.com'
    export LD_EVENTS_URL='https://events.eu.launchdarkly.com'

    ./bridge
    ```
  </CodeGroup>
</Accordion>

### C++ (server-side)

<Accordion title="Expand C++ (server-side) code sample">
  To configure an alternate service endpoint for the SDK, use `StreamingBaseUrl`, `PollingBaseUrl`, and `EventsBaseUrl` to specify the base URIs. Here are some examples for common base URIs that you might use instead of the defaults:

  <CodeGroup>
    ```cpp title="C++ SDK v3.0 (native), connecting to Relay Proxy" lines wrap theme={null}
    auto config_builder = server_side::ConfigBuilder("YOUR_SDK_KEY");
    config_builder.ServiceEndpoints()
        .RelayProxyBaseURL("https://your-relay-proxy.com:8030");
    auto config = config_builder.Build();
    if (!config) {
        /* an error occurred, config is not valid */
    }
    ```

    ```cpp title="C++ SDK v3.0 (C binding), connecting to Relay Proxy" lines wrap theme={null}
    LDServerConfigBuilder builder = LDServerConfigBuilder_New("YOUR_SDK_KEY");

    LDServerConfigBuilder_ServiceEndpoints_RelayProxyBaseURL(builder, "https://your-relay-proxy.com:8030");

    LDServerConfig config;
    LDStatus status = LDServerConfigBuilder_Build(builder, &config);
    if (!LDStatus_Ok(status)) {
        /* an error occurred, config is not valid */
    }
    ```

    ```cpp title="C++ SDK v3.0 (native), connecting to federal instance" lines wrap theme={null}
    auto config_builder = server_side::ConfigBuilder("YOUR_SDK_KEY");
    config_builder.ServiceEndpoints()
        .StreamingBaseUrl("https://stream.launchdarkly.us")
        .PollingBaseUrl("https://sdk.launchdarkly.us")
        .EventsBaseUrl("https://events.launchdarkly.us");
    auto config = config_builder.Build();
    if (!config) {
        /* an error occurred, config is not valid */
    }
    ```

    ```c title="C++ SDK v3.0 (C binding), connecting to federal instance" lines wrap theme={null}
    LDServerConfigBuilder builder = LDServerConfigBuilder_New("YOUR_SDK_KEY");
    LDServerConfigBuilder_ServiceEndpoints_StreamingBaseURL(builder, "https://stream.launchdarkly.us");
    LDServerConfigBuilder_ServiceEndpoints_PollingBaseURL(builder, "https://sdk.launchdarkly.us");
    LDServerConfigBuilder_ServiceEndpoints_EventsBaseURL(builder, "https://events.launchdarkly.us");
    LDServerConfig config;

    LDStatus status = LDServerConfigBuilder_Build(builder, &config);

    if (!LDStatus_Ok(status)) {
        /* an error occurred, config is not valid */
    }
    ```

    ```cpp title="C++ SDK v3.0 (native), connecting to EU instance" lines wrap theme={null}
    auto config_builder = server_side::ConfigBuilder("YOUR_SDK_KEY");
    config_builder.ServiceEndpoints()
        .StreamingBaseUrl("https://stream.eu.launchdarkly.com")
        .PollingBaseUrl("https://sdk.eu.launchdarkly.com")
        .EventsBaseUrl("https://events.eu.launchdarkly.com");
    auto config = config_builder.Build();
    if (!config) {
        /* an error occurred, config is not valid */
    }
    ```

    ```c title="C++ SDK v3.0 (C binding), connecting to EU instance" lines wrap theme={null}
    LDServerConfigBuilder builder = LDServerConfigBuilder_New("YOUR_SDK_KEY");
    LDServerConfigBuilder_ServiceEndpoints_StreamingBaseURL(builder, "https://stream.eu.launchdarkly.com");
    LDServerConfigBuilder_ServiceEndpoints_PollingBaseURL(builder, "https://sdk.eu.launchdarkly.com");
    LDServerConfigBuilder_ServiceEndpoints_EventsBaseURL(builder, "https://events.eu.launchdarkly.com");
    LDServerConfig config;

    LDStatus status = LDServerConfigBuilder_Build(builder, &config);

    if (!LDStatus_Ok(status)) {
        /* an error occurred, config is not valid */
    }
    ```
  </CodeGroup>

  To learn more, read `ServiceEndpoints()` in [`ConfigBuilder`](https://launchdarkly.github.io/cpp-sdks/libs/server-sdk/docs/html/classlaunchdarkly_1_1config_1_1shared_1_1builders_1_1ConfigBuilder.html).
</Accordion>

### Erlang

<Accordion title="Expand Erlang code sample">
  To configure an alternate service endpoint for the SDK, use the `stream_uri`, `base_uri`, and `events_uri` properties to set the base URIs. Here are some examples for common base URIs that you might use instead of the defaults:

  <CodeGroup>
    ```erlang title="Erlang, connecting to Relay Proxy" lines wrap theme={null}
    ldclient:start_instance("YOUR_SDK_KEY", #{
      stream_uri => "https://your-relay-proxy.com:8030",
      base_uri => "https://your-relay-proxy.com:8030",
      events_uri => "https://your-relay-proxy.com:8030"
    })
    ```

    ```erlang title="Erlang, connecting to federal instance" lines wrap theme={null}
    ldclient:start_instance("YOUR_SDK_KEY", #{
      stream_uri => "https://stream.launchdarkly.us",
      base_uri => "https://sdk.launchdarkly.us",
      events_uri => "https://events.launchdarkly.us"
    })
    ```

    ```erlang title="Erlang, connecting to EU instance" lines wrap theme={null}
    ldclient:start_instance("YOUR_SDK_KEY", #{
      stream_uri => "https://stream.eu.launchdarkly.com",
      base_uri => "https://sdk.eu.launchdarkly.com",
      events_uri => "https://events.eu.launchdarkly.com"
    })
    ```
  </CodeGroup>
</Accordion>

### Go

<Accordion title="Expand Go code sample">
  To configure an alternate service endpoint for the SDK, use the `Config.ServiceEndpoints` property and `interfaces.ServiceEndpoints()` to specify the base URIs. Here are some examples for common base URIs that you might use instead of the defaults:

  <CodeGroup>
    ```go title="Go, connecting to Relay Proxy" lines wrap theme={null}
    // To use the Replay Proxy in proxy mode for both streaming and events:

    config := ld.Config{
        ServiceEndpoints: ldcomponents.RelayProxyEndpoints(
          "https://your-relay-proxy.com:8030"),
    }

    // Alternatively, to use the Relay Proxy in proxy mode for streaming,
    // but send events directly to LaunchDarkly, use:
    config := ld.Config{
        ServiceEndpoints: ldcomponents.RelayProxyEndpointsWithoutEvents(
            "https://your-relay-proxy.com:8030"),
    }
    ```

    ```go title="Go, connecting to federal instance" lines wrap theme={null}

    config := ld.Config{
        ServiceEndpoints: interfaces.ServiceEndpoints{
          Streaming: "https://stream.launchdarkly.us",
          Polling: "https://sdk.launchdarkly.us",
          Events: "https://events.launchdarkly.us",
        },
    }
    ```

    ```go title="Go, connecting to EU instance" lines wrap theme={null}

    config := ld.Config{
        ServiceEndpoints: interfaces.ServiceEndpoints{
          Streaming: "https://stream.eu.launchdarkly.com",
          Polling: "https://sdk.eu.launchdarkly.com",
          Events: "https://events.eu.launchdarkly.com",
        },
    }
    ```
  </CodeGroup>

  <Warning>
    **Relay Proxy compatibility with event payload compression**

    If you are using LaunchDarkly Go SDK version 7.6 or greater and you choose to enable compression of event payloads, you **must** upgrade Relay Proxy to version 8.9 or greater. To learn more, read [`EnableGzip`](https://pkg.go.dev/github.com/launchdarkly/go-server-sdk/v7/ldcomponents#EventProcessorBuilder.EnableGzip) and [Configuring an SDK to use the Relay Proxy](/docs/sdk/features/relay-proxy-configuration#configuring-an-sdk-to-use-the-relay-proxy).
  </Warning>
</Accordion>

### Haskell

<Accordion title="Expand Haskell code sample">
  To configure an alternate service endpoint for the SDK, use `configSetStreamURI`, `configSetBaseURI`, and `configSetEventsURI` to specify the base URIs. Here are some examples for common base URIs that you might use instead of the defaults:

  <CodeGroup>
    ```haskell title="Haskell, connecting to Relay Proxy" lines wrap theme={null}
    {-# LANGUAGE OverloadedStrings #-}

    import LaunchDarkly.Server.Config

    import Data.Function ((&))

    config :: Config
    config = (makeConfig "YOUR_SDK_KEY")
        & configSetStreamURI "https://your-relay-proxy.com:8030"
        & configSetBaseURI "https://your-relay-proxy.com:8030"
        & configSetEventsURI "https://your-relay-proxy.com:8030"
    ```

    ```haskell title="Haskell, connecting to federal instance" lines wrap theme={null}
    {-# LANGUAGE OverloadedStrings #-}

    import LaunchDarkly.Server.Config

    import Data.Function ((&))

    config :: Config
    config = (makeConfig "YOUR_SDK_KEY")
        & configSetStreamURI "https://stream.launchdarkly.us"
        & configSetBaseURI "https://sdk.launchdarkly.us"
        & configSetEventsURI "https://events.launchdarkly.us"
    ```

    ```haskell title="Haskell, connecting to EU instance" lines wrap theme={null}
    {-# LANGUAGE OverloadedStrings #-}

    import LaunchDarkly.Server.Config

    import Data.Function ((&))

    config :: Config
    config = (makeConfig "YOUR_SDK_KEY")
        & configSetStreamURI "https://stream.eu.launchdarkly.com"
        & configSetBaseURI "https://sdk.eu.launchdarkly.com"
        & configSetEventsURI "https://events.eu.launchdarkly.com"
    ```
  </CodeGroup>

  <Warning>
    **Relay Proxy compatibility with event payload compression**

    If you are using LaunchDarkly Haskell SDK version 4.4 or greater and you choose to enable compression of event payloads, you **must** upgrade Relay Proxy to version 8.9 or greater. To learn more, read [`configSetCompressEvents`](https://launchdarkly.github.io/haskell-server-sdk/LaunchDarkly-Server-Config.html#v:configSetCompressEvents) and [Configuring an SDK to use the Relay Proxy](/docs/sdk/features/relay-proxy-configuration#configuring-an-sdk-to-use-the-relay-proxy).
  </Warning>
</Accordion>

### Java

<Accordion title="Expand Java code sample">
  To configure an alternate service endpoint for the SDK, use the `serviceEndpoints` builder method to specify the base URIs. Here are some examples for common base URIs that you might use instead of the defaults:

  <CodeGroup>
    ```java title="Java, connecting to Relay Proxy" lines wrap theme={null}
    LDConfig config = new LDConfig.Builder()
      .serviceEndpoints(Components.serviceEndpoints()
        .relayProxy("https://your-relay-proxy.com:8030"))
      .build();
    ```

    ```java title="Java, connecting to federal instance" lines wrap theme={null}
    LDConfig config = new LDConfig.Builder()
      .serviceEndpoints(Components.serviceEndpoints()
        .streaming("https://stream.launchdarkly.us")
        .polling("https://sdk.launchdarkly.us")
        .events("https://events.launchdarkly.us"))
      .build();
    ```

    ```java title="Java, connecting to EU instance" lines wrap theme={null}
    LDConfig config = new LDConfig.Builder()
      .serviceEndpoints(Components.serviceEndpoints()
        .streaming("https://stream.eu.launchdarkly.com")
        .polling("https://sdk.eu.launchdarkly.com")
        .events("https://events.eu.launchdarkly.com"))
      .build();
    ```
  </CodeGroup>
</Accordion>

### Lua

<Accordion title="Expand Lua code sample">
  To configure an alternate service endpoint for the SDK, use the `serviceEndpoints` property to specify the base URLs. Here are some examples for common base URLs that you might use instead of the defaults:

  <CodeGroup>
    ```lua title="Lua, connecting to Relay Proxy, v2" lines wrap theme={null}
    local config = {
        serviceEndpoints = {
          streamingBaseURL = "https://your-relay-proxy.com:8030",
          pollingBaseURL = "https://your-relay-proxy.com:8030",
          eventsBaseURL = "https://your-relay-proxy.com:8030"
        }
    }
    ```

    ```lua title="Lua, connecting to federal instance, v2" lines wrap theme={null}
    local config = {
        serviceEndpoints = {
          streamingBaseURL = "https://stream.launchdarkly.us",
          pollingBaseURL = "https://sdk.launchdarkly.us",
          eventsBaseURL = "https://events.launchdarkly.us"
        }
    }
    ```

    ```lua title="Lua, connecting to EU instance, v2" lines wrap theme={null}
    local config = {
        serviceEndpoints = {
          streamingBaseURL = "https://stream.eu.launchdarkly.com",
          pollingBaseURL = "https://sdk.eu.launchdarkly.com",
          eventsBaseURL = "https://events.eu.launchdarkly.com"
        }
    }
    ```
  </CodeGroup>

  To learn more about the configuration options, read [`clientInit`](https://launchdarkly.github.io/lua-server-sdk/modules/launchdarkly-server-sdk.html#clientInit).
</Accordion>

### Node.js (server-side)

<Accordion title="Expand Node.js (server-side) code sample">
  To configure an alternate service endpoint for the SDK, use the `streamUri`, `baseUri`, and `eventsUri` properties to specify the base URIs.

  Here are some examples for common base URIs that you might use instead of the defaults:

  <CodeGroup>
    ```ts title="Node.js SDK v8.x+ (TypeScript), connecting to Relay Proxy" lines wrap theme={null}
    import { LDOptions } from '@launchdarkly/node-server-sdk';

    const options: LDOptions = {
      streamUri: 'https://your-relay-proxy.com:8030',
      baseUri: 'https://your-relay-proxy.com:8030',
      eventsUri: 'https://your-relay-proxy.com:8030',
    };
    ```

    ```ts title="Node.js SDK v8.x+ (TypeScript), connecting to federal instance" lines wrap theme={null}
    import { LDOptions } from '@launchdarkly/node-server-sdk';

    const options: LDOptions = {
      streamUri: 'https://stream.launchdarkly.us',
      baseUri: 'https://sdk.launchdarkly.us',
      eventsUri: 'https://events.launchdarkly.us',
    };
    ```

    ```ts title="Node.js SDK v8.x+ (TypeScript), connecting to EU instance" lines wrap theme={null}
    import { LDOptions } from '@launchdarkly/node-server-sdk';

    const options: LDOptions = {
      streamUri: 'https://stream.eu.launchdarkly.com',
      baseUri: 'https://sdk.eu.launchdarkly.com',
      eventsUri: 'https://events.eu.launchdarkly.com',
    };
    ```
  </CodeGroup>

  <Warning>
    **Relay Proxy compatibility with event payload compression**

    If you are using LaunchDarkly Node.js (server-side) SDK version 9.8 or greater and you choose to enable compression of event payloads, you **must** upgrade Relay Proxy to version 8.9 or greater. To learn more, read [`enableEventCompression`](https://launchdarkly.github.io/js-core/packages/sdk/server-node/docs/interfaces/LDOptions.html#enableEventCompression) and [Configuring an SDK to use the Relay Proxy](/docs/sdk/features/relay-proxy-configuration#configuring-an-sdk-to-use-the-relay-proxy).
  </Warning>
</Accordion>

### PHP

<Accordion title="Expand PHP code sample">
  To configure an alternate service endpoint for the SDK, use the `base_uri` and `events_uri` properties to specify the base URIs. Here are some examples for common base URIs that you might use instead of the defaults:

  <CodeGroup>
    ```php title="PHP, connecting to Relay Proxy" lines wrap theme={null}
    $client = new LaunchDarkly\LDClient("YOUR_SDK_KEY",
        [ "base_uri" => "https://your-relay-proxy.com:8030",
          "events_uri" => "https://your-relay-proxy.com:8030" ]);
    ```

    ```php title="PHP, connecting to federal instance" lines wrap theme={null}
    $client = new LaunchDarkly\LDClient("YOUR_SDK_KEY",
        [ "base_uri" => "https://sdk.launchdarkly.us",
          "events_uri" => "https://events.launchdarkly.us" ]);
    ```

    ```php title="PHP, connecting to EU instance" lines wrap theme={null}
    $client = new LaunchDarkly\LDClient("YOUR_SDK_KEY",
        [ "base_uri" => "https://sdk.eu.launchdarkly.com",
          "events_uri" => "https://events.eu.launchdarkly.com" ]);
    ```
  </CodeGroup>

  There is not a streaming service for the PHP SDK.
</Accordion>

### Python

<Accordion title="Expand Python code sample">
  To configure an alternate service endpoint for the SDK, use the `stream_uri`, `base_uri`, and `events_uri` properties to specify the base URIs. Here are some examples for common base URIs that you might use instead of the defaults:

  <CodeGroup>
    ```python title="Python, connecting to Relay Proxy" lines wrap theme={null}
    config = Config(sdk_key='YOUR_SDK_KEY',
      stream_uri="https://your-relay-proxy.com:8030",
      base_uri="https://your-relay-proxy.com:8030",
      events_uri="https://your-relay-proxy.com:8030")
    ```

    ```python title="Python, connecting to federal instance" lines wrap theme={null}
    config = Config(sdk_key='YOUR_SDK_KEY',
      stream_uri="https://stream.launchdarkly.us",
      base_uri="https://sdk.launchdarkly.us",
      events_uri="https://events.launchdarkly.us")
    ```

    ```python title="Python, connecting to EU instance" lines wrap theme={null}
    config = Config(sdk_key='YOUR_SDK_KEY',
      stream_uri="https://stream.eu.launchdarkly.com",
      base_uri="https://sdk.eu.launchdarkly.com",
      events_uri="https://events.eu.launchdarkly.com")
    ```
  </CodeGroup>

  <Warning>
    **Relay Proxy compatibility with event payload compression**

    If you are using LaunchDarkly Python SDK version 9.5 or greater and you choose to enable compression of event payloads, you **must** upgrade Relay Proxy to version 8.9 or greater. To learn more, set [`enable_event_compression`](https://launchdarkly-python-sdk.readthedocs.io/en/latest/api-main.html#ldclient.config.Config.enable_event_compression) in the [`ldclient.config` module](https://launchdarkly-python-sdk.readthedocs.io/en/latest/api-main.html#module-ldclient.config) and read [Configuring an SDK to use the Relay Proxy](/docs/sdk/features/relay-proxy-configuration#configuring-an-sdk-to-use-the-relay-proxy).
  </Warning>
</Accordion>

### Ruby

<Accordion title="Expand Ruby code sample">
  To configure an alternate service endpoint for the SDK, use the `stream_uri`, `base_uri`, and `events_uri` properties to specify the base URIs. Here are some examples for common base URIs that you might use instead of the defaults:

  <CodeGroup>
    ```ruby title="Ruby, connecting to Relay Proxy" lines wrap theme={null}
    config = LaunchDarkly::Config.new(
      stream_uri: "https://your-relay-proxy.com:8030",
      base_uri: "https://your-relay-proxy.com:8030",
      events_uri: "https://your-relay-proxy.com:8030")
    ```

    ```ruby title="Ruby, connecting to federal instance" lines wrap theme={null}
    config = LaunchDarkly::Config.new(
      stream_uri: "https://stream.launchdarkly.us",
      base_uri: "https://sdk.launchdarkly.us",
      events_uri: "https://events.launchdarkly.us")
    ```

    ```ruby title="Ruby, connecting to EU instance" lines wrap theme={null}
    config = LaunchDarkly::Config.new(
      stream_uri: "https://stream.eu.launchdarkly.com",
      base_uri: "https://sdk.eu.launchdarkly.com",
      events_uri: "https://events.eu.launchdarkly.com")
    ```
  </CodeGroup>

  <Warning>
    **Relay Proxy compatibility with event payload compression**

    If you are using LaunchDarkly Ruby SDK version 8.7 or greater and you choose to enable compression of event payloads, you **must** upgrade Relay Proxy to version 8.9 or greater. To learn more, read [`compress_events`](https://launchdarkly.github.io/ruby-server-sdk/LaunchDarkly/Config.html#compress_events-instance_method) and [Configuring an SDK to use the Relay Proxy](/docs/sdk/features/relay-proxy-configuration#configuring-an-sdk-to-use-the-relay-proxy).
  </Warning>
</Accordion>

### Rust

<Accordion title="Expand Rust code sample">
  To configure an alternate service endpoint for the SDK, use the `ConfigBuilder` and `ServiceEndpointsBuilder` to specify the base URIs. Here are some examples for common base URIs that you might use instead of the defaults:

  <CodeGroup>
    ```rust title="Rust, connecting to Relay Proxy" lines wrap theme={null}
    let config = ConfigBuilder::new("YOUR_SDK_KEY")
        .service_endpoints(
            ServiceEndpointsBuilder::new().relay_proxy("https://your-relay-proxy.com:8030"),
        )
        .build()
        .unwrap();
    ```

    ```rust title="Rust, connecting to federal instance" lines wrap theme={null}
    let config = ConfigBuilder::new("YOUR_SDK_KEY").service_endpoints(ServiceEndpointsBuilder::new()
      .streaming_base_url("https://stream.launchdarkly.us")
      .polling_base_url("https://sdk.launchdarkly.us")
      .events_base_url("https://events.launchdarkly.us"))
      .build()
      .unwrap();
    ```

    ```rust title="Rust, connecting to EU instance" lines wrap theme={null}
    let config = ConfigBuilder::new("YOUR_SDK_KEY").service_endpoints(ServiceEndpointsBuilder::new()
      .streaming_base_url("https://stream.eu.launchdarkly.com")
      .polling_base_url("https://sdk.eu.launchdarkly.com")
      .events_base_url("https://events.eu.launchdarkly.com"))
      .build()
      .unwrap();
    ```
  </CodeGroup>

  <Warning>
    **Relay Proxy compatibility with event payload compression**

    If you are using LaunchDarkly Rust SDK version 2.4 or greater and you choose to enable compression of event payloads, you **must** upgrade Relay Proxy to version 8.9 or greater. To learn more, read [`compress_events`](https://docs.rs/launchdarkly-server-sdk/latest/launchdarkly_server_sdk/struct.EventProcessorBuilder.html#method.compress_events) and [Configuring an SDK to use the Relay Proxy](/docs/sdk/features/relay-proxy-configuration#configuring-an-sdk-to-use-the-relay-proxy).
  </Warning>
</Accordion>
