public
Created

HTTPS Test Server

  • Download Gist
ssltest.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#!/usr/bin/env node
 
const fs = require("fs"),
https = require("https");
 
var opts = {
key: fs.readFileSync("myprivatekey.pem", 'utf8'),
cert: fs.readFileSync("mypublickey.pem", 'utf8'),
ca: [fs.readFileSync("ca-pub.pem", 'utf8')],
requestCert: true,
rejectUnauthorized: true
};
 
var handler = function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
};
 
var server = https.createServer(opts, handler);
server.listen(443);

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.