Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/skunight/static-web-proxy
https://github.com/skunight/static-web-proxy
Last synced: 10 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/skunight/static-web-proxy
- Owner: skunight
- License: mit
- Created: 2018-01-24T07:21:00.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-05-22T08:05:45.000Z (over 1 year ago)
- Last Synced: 2024-10-14T13:17:55.234Z (about 1 month ago)
- Language: JavaScript
- Size: 503 KB
- Stars: 1
- Watchers: 1
- Forks: 8
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## static web proxy
静态网站代理转发容器### 安装
```shell
npm i static-web-proxy --save
```### 使用
```javascript
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()
```