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

# Using proxy mode

> This topic explains how to configure LaunchDarkly SDKs to connect to your Relay Proxy when you are running in proxy mode.

> For the complete documentation index, see [llms.txt](/llms.txt). For the full documentation snapshot, see [llms-full.txt](/llms-full.txt).

## Overview

Each SDK connects to several LaunchDarkly web services. These include services for getting feature flag data via streaming or polling, and a service for storing analytics events. By default, the SDK connects directly to LaunchDarkly for these services.

If you are using the Relay Proxy, you must configure the SDK so that it connects to the Relay Proxy for these services instead.

If you use the Relay Proxy in **proxy** mode, you must know the base uniform resource identifier (URI) of your Relay Proxy instance. This is an `http` or `https` address with the hostname and port where you have deployed the Relay Proxy. In all of the code examples below, the Relay Proxy's base URI is `https://your-relay-proxy.com:8030`, which is its default port.

Different SDKs have different ways of configuring the SDK. In some SDKs, you must set the base URI of each service to the Relay Proxy's base URI, using a separate configuration property for each service but setting each one to the same value. In other SDKs, you can set the base URI for all services with a single configuration property.

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 [Configuration](/sdk/features/config).

The following examples also include configuring the events service. To learn more, read [Deciding how to handle analytics events](/sdk/features/relay-proxy-configuration#deciding-how-to-handle-analytics-events).

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)](#nodejs-client-side)
* [React Native](#react-native)
* [React Web](#javascript) The React Web SDK relies on the JavaScript SDK for these configuration options.
* [Roku](#roku)

### .NET (client-side)

<Accordion title="Expand .NET (client-side) code sample">
  To connect the SDK to the Relay Proxy, use the `ServiceEndpoints` builder method and `Components.ServiceEndpoints().RelayProxy` to specify the base URI of your Relay Proxy:

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

### Android

<Accordion title="Expand Android code sample">
  To connect the SDK to the Relay Proxy, use the `streamUri`, `pollUri`, and `eventsUri` builder methods to specify the base URI of your Relay Proxy:

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

    ```kotlin title="Kotlin" theme={null}
          val ldConfig: LDConfig = LDConfig.Builder(AutoEnvAttributes.Enabled)
            .mobileKey("example-mobile-key")
            .serviceEndpoints(
              Components.serviceEndpoints()
                .relayProxy("https://your-relay-proxy.com:8030")
            )
            .build()
    ```
  </CodeGroup>
</Accordion>

### C++ (client-side)

<Accordion title="Expand C++ code sample">
  To connect the SDK to the Relay Proxy, use `RelayProxyBaseURL` to set the base URI of your Relay Proxy:

  <CodeGroup>
    ```cpp title="C++ SDK v3 (native)" theme={null}
          auto config_builder = client_side::ConfigBuilder("example-mobile-key");
          config_builder.ServiceEndpoints().RelayProxyBaseURL("https://your-relay-proxy.com:8030");
          auto config = config_builder.Build();
    ```
  </CodeGroup>

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

### Electron

<Accordion title="Expand Electron code sample">
  To connect the SDK to the Relay Proxy, set the `streamUrl`, `baseUrl`, and `eventsUrl` options to the base URI of your Relay Proxy:

  <CodeGroup>
    ```js title="JavaScript" 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" 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',
          };
    ```
  </CodeGroup>
</Accordion>

### Flutter

<Accordion title="Expand Flutter code sample">
  To connect the SDK to the Relay Proxy, use the `ServiceEndpoints` configuration option to specify the base URI of your Relay Proxy:

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

    ```dart title="Flutter SDK v3.x" theme={null}
          LDConfig ldConfig = LDConfigBuilder('example-mobile-key', AutoEnvAttributes.Enabled)
            .streamUri('https://your-relay-proxy.com:8030')
            .pollUri('https://your-relay-proxy.com:8030')
            .eventsUri('https://your-relay-proxy.com:8030')
            .build();
    ```
  </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 connect the SDK to the Relay Proxy, set the `streamUrl`, `baseUrl`, and `eventsUrl` properties to the base URI of your Relay Proxy:

  <CodeGroup>
    ```swift title="Swift" 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" 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"];
    ```
  </CodeGroup>

  <Warning title="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](/sdk/features/relay-proxy-configuration#configuring-an-sdk-to-use-the-relay-proxy).
  </Warning>
</Accordion>

### Java

Script

<Accordion title="Expand JavaScript code sample">
  To connect the SDK to the Relay Proxy, set the `streamUrl`, `baseUrl`, and `eventsUrl` properties to the base URI of your Relay Proxy:

  <CodeGroup>
    ```js title="JavaScript" 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" theme={null}
          import * as ld from 'launchdarkly-js-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',
          };
    ```
  </CodeGroup>
</Accordion>

### Node.js (client-side)

<Accordion title="Expand Node.js (client-side) code sample">
  To connect the SDK to the Relay Proxy, set the `streamUrl`, `baseUrl`, and `eventsUrl` properties to the base URI of your Relay Proxy:

  <CodeGroup>
    ```js title="JavaScript" 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" 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',
          };
    ```
  </CodeGroup>
</Accordion>

### React Native

<Accordion title="Expand React Native code sample">
  To connect the SDK to the Relay Proxy, set the `streamUri`, `baseUri`, and `eventsUri` properties to the base URI of your Relay Proxy:

  <CodeGroup>
    ```ts title="React Native SDK v10" 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',
          };
    ```
  </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>

### Roku

<Accordion title="Expand Roku code sample">
  <Warning title="The Relay Proxy only works with the Roku SDK in polling mode">
    The Relay Proxy works when the Roku SDK is in polling mode only. You cannot use the Relay Proxy if the Roku SDK is in streaming mode.
  </Warning>

  To connect the SDK to the Relay Proxy, use the `setStreamURI`, `setAppURI`, and `setEventsURI` methods to specify the base URI of your Relay Proxy:

  <CodeGroup>
    ```brightscript title="BrightScript" 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>

## Server-side SDKs

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

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

### .NET (server-side)

<Accordion title="Expand .NET (server-side) code sample">
  To connect the SDK to the Relay Proxy, use the `ServiceEndpoints` builder method and `Components.ServiceEndpoints().RelayProxy` to specify the base URI of your Relay Proxy:

  <CodeGroup>
    ```csharp title=".NET SDK v6.3 and later (C#)" theme={null}
          var config = Configuration.Builder("YOUR_SDK_KEY")
              .ServiceEndpoints(Components.ServiceEndpoints()
                .RelayProxy("https://your-relay-proxy.com:8030"))
              .Build();
    ```
  </CodeGroup>
</Accordion>

### C++ (server-side)

<Accordion title="Expand C++ (server-side) code sample">
  To connect the SDK to the Relay Proxy, use `RelayProxyBaseURL` to set the base URI of your Relay Proxy:

  <CodeGroup>
    ```cpp title="C++ SDK v3.0 (native)" 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 */
          }
    ```

    ```c title="C++ SDK v3.0 (C binding)" 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 */
          }
    ```

    ```c title="C SDK v2.x (native)" theme={null}
          struct LDConfig *config = LDConfigNew("YOUR_SDK_KEY");
          LDConfigSetStreamURI(config, "https://your-relay-proxy.com:8030");
          LDConfigSetBaseURI(config, "https://your-relay-proxy.com:8030");
          LDConfigSetEventsURI(config, "https://your-relay-proxy.com:8030");
    ```
  </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 connect the SDK to the Relay Proxy, set the `stream_uri`, `base_uri`, and `events_uri` properties to the base URI of your Relay Proxy:

  <CodeGroup>
    ```erlang title="Erlang" 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"
          })
    ```
  </CodeGroup>
</Accordion>

### Go

<Accordion title="Expand Go code sample">
  To connect the SDK to the Relay Proxy, use the `Config.ServiceEndpoints` property and `ldcomponents.RelayProxyEndpoints()` to specify the base URI of your Relay Proxy:

  <CodeGroup>
    ```go title="Go" 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"),
          }
    ```
  </CodeGroup>

  <Warning title="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](/sdk/features/relay-proxy-configuration#configuring-an-sdk-to-use-the-relay-proxy).
  </Warning>
</Accordion>

### Haskell

<Accordion title="Expand Haskell code sample">
  To connect the SDK to the Relay Proxy, use `configSetStreamURI`, `configSetBaseURI`, and `configSetEventsURI` to specify the base URI of your Relay Proxy:

  <CodeGroup>
    ```haskell title="Haskell" 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"
    ```
  </CodeGroup>

  <Warning title="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](/sdk/features/relay-proxy-configuration#configuring-an-sdk-to-use-the-relay-proxy).
  </Warning>
</Accordion>

### Java

<Accordion title="Expand Java code sample">
  To connect the SDK to the Relay Proxy, use the `serviceEndpoints` builder method and `Components.serviceEndpoints().relayProxy` to specify the base URI of your Relay Proxy:

  <CodeGroup>
    ```java title="Java SDK v5.9 and later" theme={null}
          LDConfig config = new LDConfig.Builder()
            .serviceEndpoints(Components.serviceEndpoints()
              .relayProxy("https://your-relay-proxy.com:8030"))
            .build();
    ```
  </CodeGroup>
</Accordion>

### Lua

<Accordion title="Expand Lua code sample">
  To connect the SDK to the Relay Proxy, use the `serviceEndpoints` property to specify the base URLs:

  <CodeGroup>
    ```lua title="Lua SDK v2" 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 SDK v1.x" theme={null}
          local config = {
              key = "YOUR_SDK_KEY",
              streamURI = "https://your-relay-proxy.com:8030",
              baseURI = "https://your-relay-proxy.com:8030",
              eventsURI = "https://your-relay-proxy.com:8030",
          }
    ```
  </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 connect the SDK to the Relay Proxy, set the `streamUri`, `baseUri`, and `eventsUri` properties to the base URI of your Relay Proxy:

  <CodeGroup>
    ```ts title="Node.js SDK v8.x (TypeScript)" theme={null}
          import * as ld from '@launchdarkly/node-server-sdk';

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

    ```js title="Node.js SDK v7.x (JavaScript)" 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',
          };
    ```

    ```ts title="Node.js SDK v7.x (TypeScript)" theme={null}
          import * as ld from 'launchdarkly-node-server-sdk';

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

  <Warning title="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](/sdk/features/relay-proxy-configuration#configuring-an-sdk-to-use-the-relay-proxy).
  </Warning>
</Accordion>

### PHP

<Accordion title="Expand PHP code sample">
  To connect the SDK to the Relay Proxy, set the `base_uri` and `events_uri` properties to the base URI of your Relay Proxy:

  <CodeGroup>
    ```php title="PHP" 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" ]);
    ```
  </CodeGroup>

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

### Python

<Accordion title="Expand Python code sample">
  To connect the SDK to the Relay Proxy, set the `stream_uri`, `base_uri`, and `events_uri` properties to the base URI of your Relay Proxy:

  <CodeGroup>
    ```python title="Python" 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")
    ```
  </CodeGroup>

  <Warning title="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](/sdk/features/relay-proxy-configuration#configuring-an-sdk-to-use-the-relay-proxy).
  </Warning>
</Accordion>

### Ruby

<Accordion title="Expand Ruby code sample">
  To connect the SDK to the Relay Proxy, set the service endpoints to the base URI of your Relay Proxy:

  <CodeGroup>
    ```ruby title="Ruby" 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")
    ```
  </CodeGroup>

  <Warning title="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](/sdk/features/relay-proxy-configuration#configuring-an-sdk-to-use-the-relay-proxy).
  </Warning>
</Accordion>

### Rust

<Accordion title="Expand Rust code sample">
  To connect the SDK to the Relay Proxy, use the `ConfigBuilder` and `ServiceEndpointsBuilder` to specify the base URI of your Relay Proxy:

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

  <Warning title="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](/sdk/features/relay-proxy-configuration#configuring-an-sdk-to-use-the-relay-proxy).
  </Warning>
</Accordion>
