Using a proxy

3 minute read

Applications using the CloudBees Feature Management service do so through one of the CloudBees Feature Management SDKs.

The SDKs need to connect across the public internet to the CloudBees Feature Management service for multiple reasons, for example, to get feature flag configurations and to upload impression data. This can be a problem for application code running inside a closed/secured network, where direct access to the public internet is blocked, such as for security reasons.

To help with this, CloudBees Feature Management provides a simple proxy created specifically to allow application code, using one of the CloudBees Feature Management SDKs, to proxy all network traffic to the CloudBees Feature Management backend services. This simple proxy is provided as a Docker image. You can also use a standard HTTP proxy, such as Squid, Nginx or Apache.

Using either the simple proxy or an HTTP proxy involves two steps:

  1. Run the proxy on a machine or node with the following capabilities:

    1. The machine or node must have public internet access.

    2. The application running the CloudBees Feature Management SDK must be able to connect to the machine or node using the proxy.

  2. Update the application’s CloudBees Feature Management SDK code to use the proxy.

For more information, refer to Using the simple proxy or Using an HTTP proxy.

Example application communicating with CloudBees Feature Management Proxy.
Figure 1. The CloudBees Feature Management SDK within the application uses the system network to connect with the proxy, which then connects to CloudBees over the public internet.

Using the simple proxy

The simple proxy is provided by CloudBees as a Docker image to proxy all network traffic to CloudBees Feature Management backend services.

To use the simple proxy:

  1. Run the Proxy Docker image.

    The Proxy Docker image and Documentation are available on DockerHub: A simple proxy for CloudBees Feature Management SDKs.
  2. Make sure that any applications connected to CloudBees have CloudBees Feature Management SDKs installed that can access the proxy.

    For more information, refer to CloudBees Feature Management SDK installation.

    Please refer to the CloudBees Feature Management changelog for each SDK to verify when the proxy support was added.
  3. Provide the proxy option to the roxOptions object when calling Rox.Setup for each application that uses the CloudBees Feature Management SDK.

  4. Add the following code to the SDK code to enable the SDK to use the proxy.

    The SDK code changes for each language are as follows:

    React Native
    JavaScript
    Node.js
    .NET
    Android
    Java
    const options = { proxy: { protocol: 'https', host: 'companyProxy' } } await Rox.setup('<ROLLOUT-ENV-KEY>', options);
    const options = { proxy: { protocol: 'https', host: 'companyProxy' } } await Rox.setup('<ROLLOUT-ENV-KEY>', options);
    const options = { proxy: { protocol: 'https', host: 'companyProxy' } } await Rox.setup('<ROLLOUT-ENV-KEY>', options);
    var options = new RoxOptions(new RoxOptions.RoxOptionsBuilder { Proxy = new WebProxy(new Uri("https://companyProxy")) });
    RoxOptions options = new RoxOptions.Builder() .withProxy(new ProxyConfig("http://proxy.example.com", "sdkuser", "sdkpassword")) .build(); Rox.setup("<ROLLOUT-ENV-KEY>", options);
    RoxOptions options = new RoxOptions.Builder() .withProxy(new ProxyConfig("http://proxy.example.com", "sdkuser", "sdkpassword")) .build(); Rox.setup(this, options);

Using an HTTP proxy

With an HTTP proxy, you can use Squid, Nginx or Apache standard HTTP proxies for your requests. Refer to your selected SDK documentation for more information.

HTTP proxy support is currently only included for the Java SDK. To use a standard HTTP proxy with a different SDK, contact CloudBees support.

An HTTP proxy can proxy both HTTP (unencrypted) and HTTPS (encrypted) traffic.

To use an HTTP proxy:

  1. Provide the proxy option to the roxOptions object when calling Rox.Setup for each application that uses the CloudBees Feature Management SDK.

  2. Add the following code to the SDK code to enable the SDK to use the proxy.

    The SDK code changes for each language are as follows:

    Java
    new RoxOptions.Builder() .withProxy(new HttpProxyConfig("companyProxy", 3128)) .build();
In this example, the proxy hostname is companyProxy and the port is 3128. Do not include the protocol (http:// or https://).