1.0.2 • Published 9 years ago
proxy-up v1.0.2
proxy-up
Simple Hapi-powered proxy server
$ npm install proxy-up
As a command-line tool
Load the configuration as the parameter.
$ proxy-up myconfig.jsonThe myconfig.json file takes a Hapi configuration object:
{
"server": {
"host": "0.0.0.0",
"port": 3000
},
"proxy": [{
"method": "*",
"path": "/{p*}",
"handler": {
"proxy": {
"host": "google.com",
"port": 80,
"redirects": 5
}
}
}]
}The configuration itself can either be JSON or JavaScript.
Programmatic usage
const proxyup = require('proxyup');
proxyup({
server: {
host: '0.0.0.0',
port: 3000,
},
proxy: [{
method: '*',
path: '/{p*}',
handler: {
proxy: {
host: 'google.com',
port: 80,
redirects: 5,
},
},
}],
})API
proxyup(config, statusRoute = true)The function accepts a second parameter which is set to true by default. If set to true, it exports a status route on /status which returns ok by default. (This can be used an AWS ELB status check.)
License
MIT