Skip to main content

Documentation Index

Fetch the complete documentation index at: https://launchdarkly-preview.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Server-side SDKs

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

.NET (server-side)

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:
      var config = Configuration.Builder("YOUR_SDK_KEY")
          .ServiceEndpoints(Components.ServiceEndpoints()
            .RelayProxy("https://your-relay-proxy.com:8030"))
          .Build();

Apex

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.To configure an alternate service endpoint for the SDK, export the alternate URIs before you build the bridge:
      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

C++ (server-side)

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:
      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 */
      }
To learn more, read ServiceEndpoints() in ConfigBuilder.

Erlang

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:
      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"
      })

Go

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:
      // 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"),
      }
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 and Configuring an SDK to use the Relay Proxy.

Haskell

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:
      {-# 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"
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 and Configuring an SDK to use the Relay Proxy.

Java

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:
      LDConfig config = new LDConfig.Builder()
        .serviceEndpoints(Components.serviceEndpoints()
          .relayProxy("https://your-relay-proxy.com:8030"))
        .build();

Lua

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:
      local config = {
          serviceEndpoints = {
            streamingBaseURL = "https://your-relay-proxy.com:8030",
            pollingBaseURL = "https://your-relay-proxy.com:8030",
            eventsBaseURL = "https://your-relay-proxy.com:8030"
          }
      }
To learn more about the configuration options, read clientInit.

Node.js (server-side)

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:
      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',
      };
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 and Configuring an SDK to use the Relay Proxy.

PHP

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:
      $client = new LaunchDarkly\LDClient("YOUR_SDK_KEY",
          [ "base_uri" => "https://your-relay-proxy.com:8030",
            "events_uri" => "https://your-relay-proxy.com:8030" ]);
There is not a streaming service for the PHP SDK.

Python

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:
      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")
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 in the ldclient.config module and read Configuring an SDK to use the Relay Proxy.

Ruby

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:
      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")
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 and Configuring an SDK to use the Relay Proxy.

Rust

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:
      let config = ConfigBuilder::new("YOUR_SDK_KEY")
          .service_endpoints(
              ServiceEndpointsBuilder::new().relay_proxy("https://your-relay-proxy.com:8030"),
          )
          .build();
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 and Configuring an SDK to use the Relay Proxy.