I have established a private Cloud Integration>Basic Secure Connection, but then to use/access it I have to use mutual TLS in my node.js application (which is on also on BlueMix).
I have seen this post: https://developer.ibm.com/bluemix/2015/04/17/securing-destinations-tls-bluemix-secure-gateway/ which describes a way to use the private Secure Connection.
But what I am trying to do is to send an HTTPS request to the Secure Connection, so that it goes to my backend. In the node.js, I have a HTTP server which handles user actions and I am using the following code to make the HTTPS request:
var https = require('https');
var fs = require('fs');
var options = {
host: cloud_ip,
port: cloud_port,
path: '/path_to_resource',
method: 'POST',
cert: fs.readFileSync('<endpoint>-basic-client-cert.pem'),
key: fs.readFileSync('<endpoint>-basic-private-key'),
ca: fs.readFileSync('DigiCertCA2.pem'),
agent: false,
};
var req = https.request(options, callback);
req.on('error', function(e) {
io.emit('message', 'Error: ' +JSON.stringify(e));
});
req.end()
And I get no response from my backend, I tried to monitor what is happening with Wireshark (locally), and it seems that the connection is refused/denied. I don't really know what I should do with the different certificates downloaded from BlueMix. I would really appreciate if someone could help.
req.on("data")either. - Jeff Sloyer