4

in Curl, I can do -k to perform insecure SSL connections and transfers. However, in node.js, I check the doc for HTTPS. I can't find any options that can do it.

The reason I need this is that I need to call a remote server. I have the cert & passphrase. It can connect. However, since the cert's url is different from the host, the Secure check fail. Well, due to some Operational reason, the cert has to be that way and I'm unable to change it. I have tried putting http.options.hostname be the one same as in the cert. But, it fails as well.

So, what other options I can use?

murvinlai
  • 48,919
  • 52
  • 129
  • 177
  • The point of HTTPS is to _not make insecure calls_ so please don't ask for a way to circumvent this in the title. – TheZ Aug 13 '12 at 22:09
  • 7
    Geeezz. Don't you think I dunno? but I need to make this kind of connection inside our internal network. If without reason, I won't post it here. I think it is a place to help.. right? – murvinlai Aug 13 '12 at 22:20
  • Actually, I was more referring to the fact in the body of your question you are more open to alternative solutions, whereas the title only seems to reference your want to force it to be insecure. – TheZ Aug 13 '12 at 22:45
  • 1
    @TheZ you know you can edit the title, right? – Maus Jul 18 '13 at 18:18

3 Answers3

3

try rejectUnauthorized in options of https.request

anderZubi
  • 6,414
  • 5
  • 37
  • 67
2

I haven't been able to get node-curl working, but setting NODE_TLS_REJECT_UNAUTHORIZED env variable to 0 helped. I used the request library to make the HTTPS request.

https://github.com/visionmedia/superagent/issues/205#issuecomment-21669569

0

The best approach to solve https over insecure SSL certificate it's use a node-curl module and set SSL_VERIFYPEER to false.

var http = require('http');
var curl = require('node-curl');

http.createServer(function(request,response){

    var url = 'https://url';
    url += request.url;

    console.log(url);


    curl(url,
        { 
            SSL_VERIFYPEER : 0
        },
        function(err){
            response.end(this.body);
        })

}).listen(8000);
calca
  • 61
  • 6