Overriding the apiHost/wsHost to proxy requests to Sendbird

We need to proxy requests to Sendbird from the JS SDK. It doesn’t look like it’s possible to set a normal HTTP proxy with Sendbird SDK - is that correct? It looks like the Sendbird JS SDK is using Axios for http requests, which does support http proxies, but sendbird’s SDK doesn’t provide any way to set the proxy config param that I can see.

Instead, it looks like there’s an option to override the Sendbird API Host and Websocket Host for the SDK. We’re thinking of using this to manually proxy API requests to Sendbird by making a fake api endpoint on our server which just passes along the request to Sendbird, except properly passing it through our http proxy. Are there any downsides to doing this? Will Sendbird start rate-limiting our servers’ IP or block the IP if there’s a large number of proxied API requests coming from our IP?

1 Like

Hi David,

Please give me a while and I will find out the answers to your questions.

Are there any news upon this? We are thinking of also setup a proxy-server, mostly to protect (secret) API tokens from getting exposed at mobile clients. Or is there a better approacht to protect secret keys, except some sort of proxy?

Any news? Does the Sendbird JS SDK supports changing the API host?

Hello @this_is_unique,

Welcome to the Sendbird Community. This is not documented yet, but you can pass in a custom API Host or WS Host to proxy requests:

sb.connect(userId, accessToken, customApi, customWs, (user, error) => {
      if (error) {
        reject(error);
      } else {
        resolve({
          userId
        });
      }
    });