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 🙏

© 2025 – Pkg Stats / Ryan Hefner

sfp

v0.0.17

Published

Simple & fast debugging proxy for node.

Downloads

90

Readme

simpleFastProxy

npm

Nodejs based debugging proxy.

Currently I'm developing only the features I need. I'm open to suggestions and help. The main objective of this project is providing a very flexible and easy to use debugging proxy. Later goals include providing a web based UI for inspecting traffic.

Usage

Import it;

var sfp = require('sfp');

The proxy gets a rule list as an array. Init the proxy with this array and an options object;

var myProxy = new sfp.Proxy(mainRuleList, options);

Each item in the rule list array can have a "match" field that will match a request specific to that rule item. Multiple matches are ORed.

{
    //Optional match property
    match: [
        {
           ...
        },
        ...
    ],
    //Action items when the match is valid
    //(modify, delete, cache)
    ...
}

For example to match a request header;

match: [
    {
        type: "requestHeader",
        name: "origin",
        value: "..."
    }
]

or match a request header without using a value;

match: [
	{
		type: "requestHeader",
		name: "range"
	}
]

Allowed match types are currently; requestHeader, responseHeader or url.

Action Items:

You can modify a header using placeholders from request headers. Inject origin for CORS, or allow credentials;

modify: [
	{
		type: "responseHeader",
		name: "access-control-allow-origin",
		value: '{~{requestHeader.origin}~}'
	},
	{
		type: "responseHeader",
		name: "access-control-allow-credentials",
		value: 'true'
	}
]

Inject origin;

modify: [
	{
		type: "requestHeader",
		name: "origin",
		value: ''
	},
	{
		type: "requestHeader",
		name: "referer",
		value: ''
	}
]

Injecting a cookie;

modify: [
	{
		type: "requestHeader",
		name: "cookie",
		value: ''
	}
]

Prevent cache;

modify: [
	{
		type: "responseHeader",
		name: "cache-control",
		value: 'no-cache, no-store, must-revalidate'
	},
	{
		type: "responseHeader",
		name: "pragma",
		value: 'no-cache'
	},
	{
		type: "responseHeader",
		name: "expires",
		value: '0'
	}
]
	  

Remove headers;

delete: [
	{
		type: "responseHeader",
		name: "x-frame-options",
		value: ''
	},
	{
		type: "responseHeader",
		name: "accept-ranges",
		value: ''
	}
]

Remove accept-ranges response header if a range request arrives;

"modify": [
{
    type: "responseHeader",
    name: "accept-ranges",
    value: "none"
}

You can cache files by setting "cache" property;

cache: true

Modify response body (use search & replace instead of name/value);

modify: [
	{
		type: "responseBody",
		search: "https:",
		replace: "http:"
	}
]

You may use a js regular expression on search. For example to replace the whole response body;

modify: [
	{
		type: "responseBody",
		search: "^[^]*",
		replace: "Hello World"
	}
]

Note: Only gzipped bodies can be manipulated. So it is advised to inject an Accept-Encoding header to the requests.

Options:

{
	"port": 8888 //Proxy port (defaults to 8888),
	"tempFolder": "/tmp/", //Temporary file folder (defaults to "/tmp/"),
	"externalProxyHost": null, //Additional proxy host and port (requests will be further forwarded to this endpoint);
	"externalProxyPort": null,
	"interceptSSL": true, //Should the proxy intercept HTTPS requests? Below options are necessary if this is true.
	"rootCAKey": "path/to/rootCA/key", //root CA key file (.key)
	"rootCACert": "path/to/rootCA/cert", //root CA certificate file (.pem)
	"rootCAPass": "XXXX" //root CA passphrase
}

Note: To be able to use SSL features, openSSL must be installed on your system and available on the command line/shell. (https://wiki.openssl.org/index.php/Binaries for binaries)

CLI

To run the proxy server from the command line, install it globally (npm install -g sfp) and pass a json file name. In the json file there must be an array of two items. The first array will be used as the mainRuleList and second one as the options object.

For example;

[
	[],
	{
		"tempFolder": "/tmp/"
	}
]