在最新的Node&NPM下,SSL握手与Express服务器失败

Cha*_*son 10 ssl https node.js express

我将Mac上的Node.js升级到最新的0.12.4,以及NPM升级到2.10.1,然后我为我的Express项目重新运行了npm install.

现在,当我访问https:// localhost:3001时,Chrome中的"此网页不可用/ ERR_CONNECTION_REFUSED".当我跑步时,curl -v https://localhost:3001我得到了

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
Run Code Online (Sandbox Code Playgroud)

这肯定是升级Node.js的结果,因为升级后问题会立即出现.

我开始这样的服务:

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);
Run Code Online (Sandbox Code Playgroud)

有没有人有什么想法导致这个问题?

Moh*_*SRI 2

我遇到了同样的问题,试试这个:

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
    };
Run Code Online (Sandbox Code Playgroud)