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

proxy-box

v0.0.6

Published

A CLI to create and manage containerized proxy servers for working around HTTP and CORS shenanigans

Downloads

2

Readme

Proxy Box

A CLI to create and manage containerized proxy servers. Useful for woking around HTTPS and CORS hurdles in local development environments.

Getting started

Dependencies

In order for proxy-box to do its thing, you'll need the following installed:

  • Node (>=8) & NPM (>= 5)
  • Docker

Setup

First, install the proxy-box package globally:

npm install -g proxy-box

Next, if you're going to be using the HTTPS listener, you'll want to download this localhost SSL certificate and install it in your list of locally trusted roots. How you do that is dependent on your OS/browser, so you're gonna have to Google it if you're unfamiliar.

Finally, you'll want to initialize the proxy-box Docker image:

pxbx init

And you should be ready to start making boxes!

Usage

pxbx init

This command initializes proxy-box by downloading the Docker image it relies on to create instances. You can use the --skip-pull flag to force the image to build locally instead of attempting to pull from Docker Hub.

| Flag | Description | |---------------|-----------------------------------------------| | --skip-pull | Skip attempting to pull image from Docker Hub | | --debug | Enable debug logging for this command | | --help | View help docs for this command |

pxbx create

This command creates proxy-box instances. You can pass it a config file with the --file or -f flags, or provide full configuration via flags. If you do both, the flags you provide in the command will override config file properties.

| Flag | Description | |----------------|---------------------------------------| | --file, -f | Path to a config file | | --target | The proxy target URL | | --http | The port to listen on for HTTP | | --https | The port to listen on for HTTPS | | --cors | Enable CORS handling | | --debug | Enable debug logging for this command | | --help | View help docs for this command |

A config file might look something like this:

{
  "http": 4000,
  "https": 4443,
  "target": "https://localhost:3000",
  "cors": true
}

Of the configuration options, target and at least one of http or https is required to create an instance.

Some example commands:

# Create from a config file
pxbx create mybox -f config.json

# Create a simple HTTP proxy to localhost
pxbx create mybox --http 5000 --target http://localhost:3000

# Use a config file but override some properties
pxbx create mybox -f config.json --https 8443 --cors

pxbx start

This command starts your proxy-box instances. It takes a name as its third argument, and that's basically it.

| Flag | Description | |-----------|---------------------------------------| | --debug | Enable debug logging for this command | | --help | View help docs for this command |

An example command:

# Start an instance named "mybox"
pxbx start mybox

pxbx stop

This command stops your proxy-box instances. It also takes a name as its third argument, and that's basically it.

| Flag | Description | |-----------|---------------------------------------| | --debug | Enable debug logging for this command | | --help | View help docs for this command |

An example command:

# Stop an instance named "mybox"
pxbx stop mybox

pxbx restart

This command restarts your proxy-box instances. It also takes a name as its third argument, and that's basically it.

| Flag | Description | |-----------|---------------------------------------| | --debug | Enable debug logging for this command | | --help | View help docs for this command |

An example command:

# Restart an instance named "mybox"
pxbx restart mybox

pxbx rm

This command removes your proxy-box instances. It takes a name as its third argument, and you can pass it --force or -f to force remove running instances.

| Flag | Description | |-----------------|---------------------------------------| | --force, -f | Force remove a running instance | | --debug | Enable debug logging for this command | | --help | View help docs for this command |

Some example commands:

# Remove a stopped instance named "mybox"
pxbx rm mybox

# Remove a running instance named "alsomybox"
pxbx rm -f alsomybox

pxbx logs

This command retrieves logs from your proxy-box instances. It takes a name as its third argument, and you can pass it --follow or -f to tail the logs for running instances.

| Flag | Description | |------------------|---------------------------------------| | --follow, -f | Tail logs for a running instance | | --debug | Enable debug logging for this command | | --help | View help docs for this command |

Some example commands:

# View logs for an instance named "mybox"
pxbx logs mybox

# Tail logs for a running instance named "mybox"
pxbx logs -f mybox

pxbx ls

This command lists your proxy-box instances. It'll tell you the name, status, and configuration of each.

An example command:

# List those instances
pxbx ls

Development

To work on pxbx locally, you can use npm link to make the command available.

To work on the proxy server image itself, you can use npm run dev inside the server directory to start up a dev server. For example:

npm run dev -- --target http://localhost:3000 --http 5000 --https 6000