node-restify icon indicating copy to clipboard operation
node-restify copied to clipboard

Wrong scheme for secured server url (with pkcs12 certificate)

Open deguich opened this issue 4 years ago • 0 comments

Print a server url starting with http, should be https (restify version 8.5.1) :

const https_options = {
  http2: {
    pfx: fs.readFileSync(process.env.CERT_PKCS12),
    passphrase: process.env.CERT_PKCS12_PWD,
  },
};

const server = restify.createServer(https_options);

server.listen(process.env.APP_PORT, process.env.APP_HOST, function () {
  // server.secure = true; // Should be automatically set if server is secured
  console.log("%s listening at %s", server.name, server.url);
});

Same if using this https_options :

const https_options = {
  httpsServerOptions: {
    pfx: fs.readFileSync(process.env.CERT_PKCS12),
    passphrase: process.env.CERT_PKCS12_PWD,
  },
};

deguich avatar Aug 25 '21 10:08 deguich