Search code examples
node.jssecure-gateway

Connect nodeJs app to on-premise server using Secure Gateway


I'm trying to connect from a nodejs webapp to a REST api hosted on premise. I bounded a Secure Gateway instance and created a destination on port 80 to the machine where the SG client for RHEL 6 is running.

The request is still throwing a Timeout exception.

Do I have to modify the nodejs application code in any way or the SG should allow me to access the REST api transparently?


Solution

  • Your Node.js app needs to talk to the Secure Gateway service and not the API directly. Where you establish a connection to your on-premise API, replace the host name and port number with the cloud host name and port number that you were given when you created the destination.

    There is an npm module to help your app obtain that host name and port - https://www.npmjs.com/package/bluemix-secure-gateway

    And an example - https://www.ibm.com/blogs/bluemix/2015/04/reaching-enterprise-backend-bluemix-secure-gateway-via-sdk-api/