Skip to main content
Question

How to use reverse proxy for Experiment SDK

  • October 10, 2024
  • 0 replies
  • 141 views

We have integrated the Experiment SDK (JavaScript) into our React application and are currently utilizing both the experiment and feature-flag functionalities.

To fetch flags data, we initialize the SDK as follows:

```javascript
this.experiment = Experiment.initializeWithAmplitudeAnalytics(apiKey);
await this.experiment.start();
```

Then, we retrieve the data using this.experiment.variant(variantKey).

However, we are encountering an issue where the flags data is blocked by ad blockers or in certain regions, preventing us from accessing the data. To resolve this, we attempted to use a reverse proxy URL like below:

```javascript
Experiment.initializeWithAmplitudeAnalytics(apiKey, { flagServerUrl: "proxy-url" });
```

Unfortunately, the SDK automatically appends `sdk/v2/flags` to each request, which makes it difficult to bypass the blockage.

 

Ultimately, we are trying to achieve a setup similar to how we apply a reverse proxy to Amplitude event requests, where we can set a reverse proxy URL for flags data retrieval through the SDK. We would like to ask if there is any way to configure the SDK to fetch flags data through a reverse proxy URL.

 

Does anyone know about how to do this?

0 replies

Be the first to reply!

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings