How to fix Node.js HTTPS Server "SSL Error"?

I am trying to use expressin conjunction with a node.js server https, but I get a warning when connecting.

The site's security certificate is not trusted!


My code is:

var WebSocketServer = require('ws').Server
    , https = require('https')
    , fs = require('fs')
    , express = require('express')
    , app = express();

app.use(express.static(__dirname + '/public'));

var options = {
    rejectUnauthorized: false,
    requestCert: true,
    agent: false,
    key: fs.readFileSync('private/key.pem'),
    cert: fs.readFileSync('private/cert.pem')
};

var server = https.createServer(options, app);
server.listen(8888);

var MainServer = new WebSocketServer({server: server});

How to fix this warning (and effectively the Identity not verified problem )?

Thank!

0
source share
2 answers

, . , ( - ), , , , .: -)

+4

SSL . Google , . , , . , ( > 200 ), , , . , , , , .

+1

Source: https://habr.com/ru/post/1542822/


All Articles