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

mocking-cors-proxy

v0.0.2

Published

mock cors header for development and testing

Readme

Mocking Cors Proxy

That's an development util - do never use for productive systems!

Quickstart

npm i -g mocking-cors-proxy
mocking-cors-proxy --help
> Usage: mocking-cors-proxy [options]
>
> Options:
>   -V, --version                  output the version number
>   -m, --map <...path to target>  statically map an endpoint to real targets
>   -p, --port <port>              start on alternative port (default is 2345)
>   -c, --config <configJson>      use config file
>   -h, --help                     output usage information
mocking-cors-proxy
> (running)
  • should forward http://localhost:2345/http/www.example.com/index.html to http://www.example.com/index.html and add cors headers to the response.
  • should forward http://localhost:2345/https/www.example.com/index.html to https://www.example.com/index.html and add cors headers to the response.
  • should forward http://localhost:2345/http/localhost:4200/app to http://localhost:4200/app so your local app and the google api seems to be on the same host and CORS security is disabled completely.
  • there's a test page at http://localhost:2345/mocking-cors-proxy-test that shows you wheter the proxy is alive and known pathes.

Intent

During development of web pages it's often useful to be able to run a local dev version with a staged central dev backend. You should not send valid CORS-Responses for localhost from every stage of your backend but while this improves security (a bit) it can lead to much harder development setups. So this proxy helps you to destroy this bit of additional security ;-)

Warning: It's not intended to use this software deployed on a central (dev-)server. There's no security and it can help people to hide their true identity while doing eval things!

Command line interface

With the command line interface you can configure the port and some static rules without writing a config file.

Example:

npm i -g mocking-cors-proxy
mocking-cors-proxy --port 8080 \
  --map "/app/ to http://localhost:4200" \
  --map "/app2 to http://localhost:4200/app/"
> (running)
  • should forward http://localhost:8080/app/ to http://localhost:4200/app/
  • should forward http://localhost:8080/app2/ to http://localhost:4200/app/ (2nd source does not end with '/' so path is replaced)
  • should also do defaults (see above) at port 8080

Config File

Using a config file, you will get more settings and reusable configurations.
Complete schema of the config can be found at: ./lib/config.schema.json

Example:

{
  "port": 8081,
  "host": "0.0.0.0",
  "accessControl": {
    "methods": [
      "GET", "HEAD", "PUT", "PATCH", "POST", "DELETE"
    ],
    "maxAge": 10,
    "requestHeaders": [
      "Authorization", "X-Custom-Header"
    ]
  },
  "staticRoutes": [
    { "from": "/app/", "to": "http://localhost:4200" },
    { "from": "/app2", "to": "http://localhost:4200/app/" },
    { "from": "/rest", "to": "http://localhost:3000/rest/" }
  ]
}
  • should forward http://localhost:8081/app/ to http://localhost:4200/app/
  • should forward http://localhost:8081/app2/ to http://localhost:4200/app/ (2nd source does not end with '/' so path is replaced)
  • should also do defaults (see above) at port 8081

Usage:

npm i -g mocking-cors-proxy
mocking-cors-proxy -c my-mocking-cors-proxy.conf.json
> (running)