I'm having problems with node.js being able to call a particular URL over SSL. I can curl the URL with no problems, so I think it must be an incompatibility between node.js and something on the remote host's network.
CURL:
(receives response)
Node.js:
var https = require('https');
var options = {
port: 443,
path: '/',
method: 'GET',
headers: { //Add headers used by curl
Accept: '*/*',
'User-Agent': 'curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5'
},
agent: false //Tried with and without this, doesn't seem to matter
};
var req = https.request(options, function(res) {
console.log("statusCode: ", res.statusCode);
console.log("headers: ", res.headers);
res.on('data', function(d) {
process.stdout.write(d);
});
});
req.end();
req.on('error', function(e) {
console.error(e);
});
Running the node.js version just hangs. I've inspected the web requests from both curl and node and verified that they are sending the same headers.
Requesting the "http" version of the same URL does work with node. I feel like there's some incompatibility between node's SSL and the remote host's SSL (it is using IIS 7.5).
The same request also doesn't work using the request library, and I also tried the setting strictSSL: false with it.
Anyone have any ideas?
Thanks,
Chris