npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

vhttps

v0.1.1

Published

Virtual Secure Servers. Hosting multiple HTTPS sites on single server/port WITHOUT reverse proxy. Can integrate with Express and vhost

Downloads

372

Readme

VHTTPS Virtual Host on HTTPS

This minimal package aims to allow hosting multiple HTTPS sites with multiple certificates on a single server/IP address, without the need to use any reverse proxy.

Install

npm install --save vhttps

Usage

Use vhttps.init:

const vhttps = require('vhttps');

const options = {
    cert: fs.readFileSync('./default-cert.pem'),
    key: fs.readFileSync('./default-key.pem'),
};

const cred_a = {
    cert: fs.readFileSync('./a-cert.pem'),
    key: fs.readFileSync('./a-key.pem'),
};

const cred_b = {
    cert: fs.readFileSync('./b-cert.pem'),
    key: fs.readFileSync('./b-key.pem'),
};

// Create an vhttps instance
const server = vhttps.init();

// Set HTTPS options (with default certificate)
server.setOptions(options);

// Introduce handlers to different domain names
server.use('a.com', cred_a, (req, res) => {
    res.end('A.COM WORKS!');
});
server.use('b.com', cred_b, (req, res) => {
    res.end('B.COM WORKS!');
});

// (optional) Add default handler
server.use((req, res) => {
    res.end('DEFAULT.COM WORKS!');
});

// Listen at port 443
server.listen(443);

Use vhttps.init with Express:

const vhttps = require('vhttps');
const express = require('express');

const options = {};

const router_a = express.Router();
router_a.get('/', (req, res) => {
    res.end('A.COM WORKS!');
});

const router_b = express.Router();
router_b.get('/', (req, res) => {
    res.end('B.COM WORKS!');
});

const cred_a = {
    cert: fs.readFileSync('./a-cert.pem'),
    key: fs.readFileSync('./a-key.pem'),
};

const cred_b = {
    cert: fs.readFileSync('./b-cert.pem'),
    key: fs.readFileSync('./b-key.pem'),
};

// Create an vhttps instance
const server = vhttps.init();

// Introduce handlers to different domain names
server.use('a.com', cred_a, router_a);
server.use('b.com', cred_b, router_b);

// Listen at port 443
server.listen(443);

Direct usage for vhttps.createServer:

const vhttps = require('vhttps');

const defaultCredential = {
    cert: fs.readFileSync('./default-cert.pem'),
    key: fs.readFileSync('./default-key.pem'),
};

const credentialA = {
    hostname: 'a.com',
    cert: fs.readFileSync('./a-cert.pem'),
    key: fs.readFileSync('./a-key.pem'),
};

const credentialB = {
    hostname: 'b.com',
    cert: fs.readFileSync('./b-cert.pem'),
    key: fs.readFileSync('./b-key.pem'),
};

const server = vhttps.createServer(defaultCredential, [credentialA, credentialB], (req, res) => {
    switch (req.headers.host) {
        case 'a.com':
            // custom handlers based on which host you are using
            res.end('A.COM works!')
            break;
        case 'b.com':
            res.end('B.COM works!')
            break;
        default:
            res.end('???');
    }
});

server.listen(443);

Direct usage for vhttps.createServer with Express vhost:

const fs = require('fs');
const express = require('express');
const vhost = require('vhost');
const vhttps = require('vhttps');

const app = express();

app.use(vhost('a.com', function (req, res) {
  res.setHeader('Content-Type', 'text/plain');
  res.end('hello from a.com!')
}));

app.use(vhost('b.com', function (req, res) {
  res.setHeader('Content-Type', 'text/plain');
  res.end('hello from b.com!');
}));

const defaultCredential = {
    cert: fs.readFileSync('./default-cert.pem'),
    key: fs.readFileSync('./default-key.pem'),
};

const credentialA = {
    hostname: 'a.com',
    cert: fs.readFileSync('./a-cert.pem'),
    key: fs.readFileSync('./a-key.pem'),
};

const credentialB = {
    hostname: 'b.com',
    cert: fs.readFileSync('./b-cert.pem'),
    key: fs.readFileSync('./b-key.pem'),
};

const httpsServer = vhttps.createServer(defaultCredential, [credentialA, credentialB], app);
httpsServer.listen(443);