10

I upgraded Node.js on my Mac to the latest, 0.12.4, as well as NPM to 2.10.1, and I re-ran npm install for my Express project.

Now, when I visit https://localhost:3001, I get "This webpage is not available / ERR_CONNECTION_REFUSED" in Chrome. When I run curl -v https://localhost:3001 I get

curl -v https://localhost:3001/
* Hostname was NOT found in DNS cache
*   Trying ::1...
* Connected to localhost (::1) port 3001 (#0)
* Server aborted the SSL handshake
* Closing connection 0
curl: (35) Server aborted the SSL handshake

This is definitely a result of upgrading Node.js, as the problem cropped up immediately after upgrading.

I start my service like this:

options = {
    key: fs.readFileSync('sslkey.pem'),
    cert: fs.readFileSync('sslcert.pem')
};
http.createServer(app).listen(settings.apiPort);
https.createServer(options, app).listen(settings.apiSSLPort);
console.log('Listening on ports: ' + settings.apiPort + ' and ' + settings.apiSSLPort);

Does anyone have any ideas what is causing this problem?

2
  • try different browser and clear cache.
    – deek
    Oct 4, 2015 at 18:03
  • What does curl -k -v https://localhost:3001/ show? The -k option tells curl to allow "insecure" connections anyway. This, combined with the -v option, should help provide more information about the cert being used by your server. Alternatively, you could use openssl s_client -connect localhost:3001. The interesting part will be to determine just when, during the SSL handshake, the connection is closed.
    – Castaglia
    Jan 5, 2016 at 22:32

1 Answer 1

2

I had the same problem, try this:

options = {
        key: fs.readFileSync('sslkey.pem', 'utf-8'),
        cert: fs.readFileSync('sslcert.pem', 'utf-8'),
        ca: fs.readFileSync(<CA_FILE>, 'utf-8'),
        requestCert: true,
        rejectUnauthorized: false
    };

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.