Node.js + SSL support

2019-03-29 10:46发布

Recent commits reference TLS progress. Any idea when it will be ready?

If not, what are the options for using SSL with a node app at the present time? Reverse proxy nginx? Is there a good tutorial available for using SSL with node?

Most professional apps need to support SSL these days and it would be great to be able to use node for these now.

标签: ssl node.js
4条回答
贪生不怕死
2楼-- · 2019-03-29 10:53

From my experience node 0.2 SSL support is very flacky and unreliable. We use nginx as a proxy.

查看更多
Anthone
3楼-- · 2019-03-29 11:01

Just for reference ... here's a JavaScript implementation of SSL/TLS:

https://github.com/digitalbazaar/forge

At the moment, it is only a client-side implementation. It would need to be expanded to cover server-side. For someone with a little knowledge about how TLS works, however, it shouldn't be too difficult to add to the existing framework.

查看更多
Evening l夕情丶
4楼-- · 2019-03-29 11:07

Node 3.x is not supposed to be used in production, it's unstable, bleeding edge development. 2.6 still has the old SSL implementation, which works.

If you want to know when all the stuff gets finished, your best bet is to either ask on the Google Group, or Ryan on Twitter.

查看更多
爷、活的狠高调
5楼-- · 2019-03-29 11:17

Node.js 0.3.4 has been released.

  • Primordal mingw build (Bert Belder)
  • HTTPS server
  • Built in debugger 'node debug script.js'
  • realpath files during module load (Mihai Călin Bazon)
  • Rename net.Stream to net.Socket
  • Fix process.platform

Example

var https = require('https');
var fs = require('fs');

var options = {
  key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
  cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
};

https.createServer(options, function (req, res) {
  res.writeHead(200);
  res.end("hello world\n");
}).listen(8000);
查看更多
登录 后发表回答