Node.js + SSL support

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.

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

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);

Solution 2

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.

Solution 3

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.

Solution 4

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

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply