Node.js HTTPS服务器不会发送数据

时间:2018-04-21 15:20:04

标签: node.js openssl

我有两个node.js服务器:一个是http,另一个是https

//HTTP server
http.createServer(function(request,response){
    unifiedServer(request,response);
}).listen(config.httpPort,function(){
    console.log('listening at port ' + config.httpPort)
});

//HTTPS server
var httpsServerOptions = {
    'key': fs.readFileSync('./https/key.pem'),
    'cert': fs.readFileSync('./https/cert.pem')
};

https.createServer(httpsServerOptions,function(request,response){
    unifiedServer(request,response);
}).listen(config.httpsPort,function(){
    console.log('listening at port ' + config.httpsPort)
});

//Instantiating the servers
var unifiedServer = function(request,response){....

当我运行它时,它将是console.log listening at port 3000(http)和listening at port 3001(https)

3000工作得很好但是..当进入3001时,我得到This page isn’t working

我已经检查了密钥和认证可能是问题,但据我所知,他们正在做他们的工作。

对此问题的任何见解表示赞赏

1 个答案:

答案 0 :(得分:0)

3001服务器的URL需要https

https://localhost:3001/home