JS SDK running on a nodejs app behind proxy

  • 16 November 2020
  • 5 replies

What is the right procedure to run a nodejs application with RC JS SDK behind a proxy?
I am trying to call rcsdk.platform.login() from behind a proxy, but the request never reaches the RC sandbox.

The same request works fine, when running in a box with direct access to the RC sandbox system.


Best answer by Tyler850957020 18 November 2020, 23:27

View original

5 replies

I don't think there are any proxy configurations in JS SDK.

Could you please try


in your environment?

Can curl reach RingCentral server? If not, could you please configure your proxy to transparently forward HTTP traffic to ?

@Tyler Liu,
Yes, RingCentral server can be reach from the command line via curl.

root@umt-virtual-machine:/opt# curl -v --insecure
* Trying
* Connected to (nil) ( port 80 (#0)
* Establish HTTP proxy tunnel to
> Host:
> User-Agent: curl/7.52.1
> Proxy-Connection: Keep-Alive
< HTTP/1.1 200 Connection established
* Proxy replied OK to CONNECT request
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* NPN, negotiated HTTP1.1
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Unknown (67):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / AES256-GCM-SHA384
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: OU=Domain Control Validated; CN=*
* start date: Jul 3 12:19:12 2020 GMT
* expire date: Jul 3 11:31:30 2022 GMT
* issuer: C=US; ST=Arizona; L=Scottsdale;, Inc.; OU=; CN=Go Daddy Secure Certificate Authority - G2
* SSL certificate verify ok.
> GET /restapi/v1.0 HTTP/1.1
> Host:
> User-Agent: curl/7.52.1
> Accept: */*
< HTTP/1.1 200 OK
< Server: nginx
< Date: Tue, 17 Nov 2020 17:56:40 GMT
< Content-Type: application/json;charset=utf-8
< Content-Length: 169
< Connection: keep-alive
< RCRequestId: 3eef543c-28fe-11eb-84ba-005056bb86e2
< RoutingKey: SJC11P01PAS02
< Content-Language: en
< Vary: Accept-Encoding, User-Agent
"uri" : "",
"versionString" : "1.0.44",
"releaseDate" : "2020-11-06T00:00:00.000Z",
"uriString" : "v1.0"
* Curl_http_done: called premature == 0
* Connection #0 to host (nil) left intact

But, callling sdk.platform.login() fails to reach the server when running on a nodejs app

FetchError: request to failed, reason: connect ETIMEDOUT

We've set in the server https_proxy and http_proxy environment variable as well we set npm configuration for proxy and https-proxy

It seems to me that the RC sdk doesn't take care of proxy configuration when calling the fetch request.

According to

Solution is

fetch('',{ agent:new HttpsProxyAgent('')}).then(function(res){

JS SDK supports options:

Please have a try and update me. I don't have an env to verify. But I reviewed the relevant code, it should work.

Sample code (un-tested):

const platform = rcsdk.platform;
const send = platform.send.bind(platform);
platform.send = (options) => {
    return send({...options, agent: new HttpsProxyAgent('YOUR PROXY SERVER')});

@Tyler Liu,
Thanks for the answer. The code posted above has solved the proxy issue.