1.0.0 • Published 8 years ago

easy-http-proxy v1.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

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.