2.0.11 • Published 3 years ago

nodejs-cors-proxy v2.0.11

Weekly downloads
158
License
ISC
Repository
-
Last release
3 years ago

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
}
2.0.11

3 years ago

2.0.10

3 years ago

2.0.9

3 years ago

2.0.8

3 years ago

2.0.5

4 years ago

2.0.4

4 years ago

2.0.7

4 years ago

2.0.3

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.1.0

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago