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 🙏

© 2024 – Pkg Stats / Ryan Hefner

https-cert-proxy

v0.4.0

Published

Creates a simple HTTPS-to-HTTP proxy for local development, using provided certificate files.

Downloads

3

Readme

https-cert-proxy

Creates a proxy to your HTTP app with HTTPS, using provided certificate files. This is designed as a convenience.

Setup Instructions

You'll need to generate a self-signed certificiate, or one from a locally trusted CA.

macOS

The mkcert package, available on Homebrew, is very easy to use.

  1. Ensure you have Homebrew installed.
  2. Run brew install mkcert nss. mkcert will create the certificate. nss will get Firefox to recognize it. (Other browsers will recognize it automatically.)
  3. Run mkcert -install to generate your local CA.
  4. Change to the directory where you'd like to save the certificates. I recommend a /certificates directory in your project.
  5. Run mkcert localhost.
  6. Ensure that the two generated files, localhost.pem and localhost-key.pem, are ignored in your source control. They would only be trusted on your local machine, so other users would run into errors.

Other Operating Systems

Contributions welcome!

Alternative Hostnames

It may be useful to use an alternative hostname for your project. For example, if you need to use cookies, you may wish to serve from localhost.YOURDOMAIN.com. To do so, you'll need to make sure the alternative hostname is in your /etc/hosts file (or equivalent). In step 5 above, replace localhost with your full domain, i.e. mkcert localhost.YOURDOMAIN.com.

Usage

In parallel with your development environment, run this as follows:

npx https-cert-proxy --cert path/to/localhost.pem --key path/to/localhost-key.pem

By default, this will proxy your existing http://localhost:3000 to https://localhost:8030. These ports can be configured using flags. For example, this will proxy from 80 (the default HTTP port) to 443 (the default HTTPS port):

npx https-cert-proxy --cert path/to/localhost.pem --key path/to/localhost-key.pem --source 80 --destination 443

I find it easiest to have these scripts in my package.json, using the package concurrently:

{
  "scripts": {
    "dev": "concurrently -n w: npm:dev-*",
    "dev-web": "YOUR CURRENT DEV SCRIPT",
    "dev-ssl": "https-cert-proxy --cert path/to/localhost.pem --key path/to/localhost-key.pem"
  },
  "devDependencies": {
    "concurrently": "^5.1.0",
    "https-cert-proxy": "^0.0.1"
  }
}

Configuring with environment variables

If you often run with the same settings, you can set up environment variables in addition to using the command-line options. The variables are as follows:

| Variable | Setting | |-------------------|----------------------| | HCP_SOURCE | Source port | | HCP_DESTINATION | Destination port | | HCP_CERTFILE | The certificate file | | HCP_KEYFILE | The key file |

If you set the HCP_CERTFILE and HCP_KEYFILE variables, you do not need to use the --cert and --key command-line options.

Copyright/License

Copyright (c) 2020-21 Todd Dukart. Licensed under the BSD-3-Clause.