static-web-proxy

2.0.0 • Public • Published

static web proxy

静态网站代理转发容器

安装

npm i static-web-proxy --save

使用

const Proxy = require('static-web-proxy')
const proxy = new Proxy({
  proxy: [
    {                                   //代理
      host: 'localhost',                //代理HOST
      scheme: 'http',                   //协议(可选,默认http)
      port: 80,                         //代理端口
      targetPath:'/',                   //代理根路径
      path: '/apin',                    //原目录(会代理到代理服务的'/'目录)
      auth: (req, res) => {},           //签名方法(可选)
      heartBeat: 5000                   //心跳检测 默认不开启
    }
  ],
  web: {
    dir: path.join(__dirname, '/dist'), //静态网站目录
    index: 'index.html'                 //初始页面文件
  },
  bind:{                                //启动绑定
    host: '0.0.0.0',
    port: 8080
  },
  compression: true,                    // gzip默认为true
  redirect: {                           //重定向
    '/a/b': {
      target: '/c/d',
      query: {
        'name': 'bbbb'
      }
    }
  }
})
proxy.start()

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.0.022latest

Version History

VersionDownloads (Last 7 Days)Published
2.0.022
1.3.72
1.3.61
1.3.51
1.3.41
1.3.31
1.3.21
1.3.11
1.3.01
1.2.51
1.2.40
1.2.30
1.2.20
1.2.10
1.2.00
1.1.00
1.0.620
1.0.610
1.0.60
1.0.50
1.0.40
1.0.30
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i static-web-proxy

Weekly Downloads

32

Version

2.0.0

License

MIT

Unpacked Size

8.26 kB

Total Files

9

Last publish

Collaborators

  • skunight