无法使用restify设置localhost https服务器

时间:2015-08-07 04:10:40

标签: node.js https localhost restify

我正在尝试在localhost上运行restify https服务器,但我一直得到“0 NO RESPONSE”。我尝试按照与node,https,localhost,...相关的关键字找到我发现的所有示例(都非常相似和简单,几乎不会出错)。还检查了收听端口的应用程序,但是仍然得到“0 NO RESPONSE”。

如果我删除服务器代码上的https配置并将请求更改为http,那么一切正常。这里可能出了什么问题?

编辑:我的代码就像这样

import restify from 'restify';
...
const server = restify.createServer({
  key: fs.readFileSync(path.join(__dirname, '..', 'key.pem')),
  certificate: fs.readFileSync(path.join(__dirname, '..', 'cert.pem'))
});
...
server.listen(443, function()...);

0 个答案:

没有答案