1.2.5 • Published 11 months ago

http-proxy-with-cors v1.2.5

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

HTTP proxy with cors

npm

Proxy HTTP requests with cors enabled.

At my company, sometimes we wanna run our local frontend against production, it's easier and faster, the problem is CORS

So I created the following npm package that act as a proxy to multiple upstream servers built on top of fastifyjs so you wont feel it

Usage

It will create a proxy server on each local port that will proxy all requests to the upstream server.

CLI arguments

npx http-proxy-with-cors <local-port-1> <upstream-1> ... <local-port-n> <upstream-n>

From file

npx http-proxy-with-cors --file <path-to-json-file>

Example config file:

[
  {
    "port": 3000,
    "upstream": "https://us1.api.server.com"
  },
  {
    "port": 3001,
    "upstream": "https://us2.api.server.com"
  }
]

Options

Config

you can pass the server from a config file using (-f or --file) or pass them as port and upstream arguments.

Logging

To disable logging, set the LOG_DISABLED environment variable to true.

1.2.5

11 months ago

1.2.4

11 months ago

1.2.3

11 months ago

1.2.2

11 months ago

1.2.1

12 months ago

1.2.0

12 months ago

1.1.2

12 months ago

1.1.1

12 months ago

1.1.0

12 months ago

1.0.1

12 months ago