node package manager
We need your input. Help make JavaScript better: Take the 2017 JavaScript Ecosystem survey »



Easily put your node server behind stud SSL terminator


You need stud installed first. Then:

npm install studify


The following starts an HTTP server on random port and stud "in front" of it port 8433.

var path = require('path');
var http = require('http');
var studify = require('studify');
var server = http.createServer(function (req, res) {
  res.writeHead(200, { 'content-type': 'text/plain' });
  res.end('Hello, stud!\n');
studify(server, {
  cert: path.join(__dirname, 'server.pem'),
  port: 8433,
  log: function () { console.log.apply(console, arguments); }


studify(server, options)

  • server (net.Server) - server stud is supposed to forward traffic to
  • options (Object)
    • options.port (number) - required. Port to start stud on
    • options.cert (string) - required. Path to PEM file with the certificate
    • options.stud (string) - stud binary, default: "stud"
    • options.ssl (boolean) - whether to use SSLv3 or not, default: true if server is an instance of http.Server
    • options.workers (number) - number of stud workers, default: 1

Returns an EventEmitter, which emits following events:

  • restart(code, signal) - stud crashed and had to be restarted
  • error(err) - ChildProcess emitted an error event