restify / restify/node-restify

Wrong scheme for secured server url (with pkcs12 certificate)

Open
#1,879 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
10.7k
Forks
975
Avg merge
1d 6h
Merged PRs (30d)
5

Description

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,
  },
};

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the createServer options and listen flow used in the report, then follow how server.url is generated for the pfx-based httpsServerOptions and http2 configurations. Reproduce both examples and verify that each secured server reports a URL beginning with https.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.