easy-http-proxy

HTTP proxying for node

Usage no npm install needed!

<script type="module">
  import easyHttpProxy from 'https://cdn.skypack.dev/easy-http-proxy';
</script>

README

easy-http-proxy

Easy proxying for node

Install

npm install --save-dev easy-http-proxy

Usage

var easyProxy = require('easy-http-proxy');

var servers = [
  { match: '/some/path/**', target: 'https://server.example.com', color: 'yellow'},
  { match: '/another/path/**', target: 'https://other-server.example.com', color: 'green'},
  { match: '/**', target: 'https://localhost', color: 'grey'},
];

var proxy  = easyProxy(servers);
proxy.listen( 9999 )

You can then access your proxy through http://localhost:9999

API

Servers configuration

  • target: url to proxy the request
  • color: color to use for this requests in console. Available colors.
  • match: glob string or function(req) to determine whether this the appropriate server to proxy this request
  • rewrite_(url)_: rewrite logic to match the target server's endpoint

See the node-http-proxy Options for available configuration.