README
node-proxy
A package about proxy http request by cors
install
npm i -g nodejs-cors-proxy
run
// open terminal enter
marklbp
// fill some option here
// dir is a web server root, you can add some other option like 'static=c:/xxxx/cccc, port=80',
marklbp dir=c:/users/marklbp/desktop/workspace ...
configuration
// marklbp.json for web server configuration
{
'proxy': {
// for proxy http request with cors
'/a/b/c': {
'protocol': 'https:', // optional
'port': 443, // optional, default is 1024
'host': 'a.b.com', // required
'path': 'a/b/c', // or `pathRewrite` required
'method': 'post', // optional
'headers': { // optional for extra headers
'a': ''
},
'credentials': true // optional for delivery cookie between server and client
},
'/a/b/upload': {
'protocol': 'http:',
'host': 'a.b.com',
'path': '/a/b/upload',
'headers': {
'a': ''
},
'credentials': true,
'upload': true // for a request about uploading file to a server flag
},
'/e': {
'protocol': 'http:',
'host': 'a.b.com',
'pathRewrite': { // for dynamic url match a set of requests
'^/e': 'ccc' // ^/e will match dynamic url as new RegExp('^/e') and replaced by the value('ccc')
},
'credentials': true
}
},
'ignoreFiles': '^upload_.*', // ignore files during watching period
'static': '' // static files directory for server querying
'port': 1024, // optional, server port
'dir': 'c:/users/marklbp/workspace', // optional, default is current directory where the command run
'disableStatic': false // disable static files for server querying
}