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

xproxy

v0.3.1

Published

http/https proxy server

Downloads

21

Readme

xproxy

NPM version Build Status

Proxy server implemented by Node.js

Features

  1. http&https server for serving static assets, could forward your request via xproxy.conf.js configuration file.
  2. support weinre to debug mobile device

Usage

install

install for project:

$ npm install xproxy 

global install:

$ npm install xproxy -g

proxy mapping rule

You could add or modify the mapping rule for proxy requests. To quickly create xproxy.conf.js boilerplate

$ xproxy init

host binding

host binding means to bind the specific domain name to your localhost

//host 127.0.0.1 xx.demo.com

recommendation of host binding tool

How to launch

Must run the cli below with the place where xproxy.config.js it is located

$ sudo xproxy server

https

prerequisite

  • to generate customized certificate template for https Must adjust the generated openssl.cnf according to your domain name
$ xproxy cert init
  • to generate certificate after modifying openssl.cnf
$ xproxy cert
  • to generate CA certificate
$ xproxy cert ca

installation

iOS

using safari to open xproxy_ca.crt in your phone. Then install it following the instructions.

You could access ${localIP}/xproxy_ca.crt in your phone after you launch xproxy. Or you could use ${boundDomaiName}/xproxy_ca.crt after you bind the domain name to your localhost in your host confi.

Mac
  • double-click xproxy_ca.crt to trigger installation
  • open keychain Access application after you finish installation. Find the certificate, right-click on the certificate and choose Get Info
  • open Trust and change the config of while using this certificate into always trust

default configuration

  • the default port for http server is 80
  • the default port for http server is 443
  • by default, serve the current working directory

You could modify the default configuration at xproxy.conf.js

parameter

| parameter | description | | --- | --- | | -r, --root | config root directory | -p, --port | port for http server to listen | -s, --ssl-port | port for https server to listen | -S, --silent | silent mode | -d, --debug | enable weinre mode

mapping rule

  • config urls in xproxy.conf.js, xproxy will return the match result once it match the rule. xproxy will manage to request production if no urls matched or no files found in local directory.
  • rule: regex expression
  • target:function or string
  • headers: function or object, to support config headers of response
  • you could set a unknow target if you want to forward the traffic to production server.
module.exports = {
    urls: [
            {
                rule: /^\/xxx\/demo.js$/,   
                target: 'noop' 
            },
            {
                rule: /(\/dir.*)$/,
                target: '~/dev/$1'
            },

            //proxy forward
            {
                rule: /cgi.*cmdname=/,
                target: 'http://11.22.33.44/$'
            },

            {
                rule: /\/mock\/demo.cgi(.*)/,
                target: function(urlPath, match, host) {
                    return '~/mock/demo.json'
                }
            }
        ]
}