Installations
npm install koa-proxy-middleware
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
7.10.1
NPM Version
4.2.0
Score
43.6
Supply Chain
72.1
Quality
71
Maintenance
100
Vulnerability
99.6
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
Mayness
Download Statistics
Total Downloads
4,954
Last Day
1
Last Week
3
Last Month
35
Last Year
596
GitHub Statistics
8 Stars
40 Commits
2 Forks
1 Watching
2 Branches
1 Contributors
Package Meta Information
Latest Version
2.0.2
Package Id
koa-proxy-middleware@2.0.2
Size
22.93 kB
NPM Version
4.2.0
Node Version
7.10.1
Publised On
16 Dec 2019
Total Downloads
Cumulative downloads
Total Downloads
4,954
Last day
0%
1
Compared to previous day
Last week
-78.6%
3
Compared to previous week
Last month
29.6%
35
Compared to previous month
Last year
-17.2%
596
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
koa-proxy-middleware
Middleware for koa2. Reverse proxy middleware for koa. Proxy resources on other servers, such as Java services, and other node.js applications. Based on http-proxy library.
Require
node v8.x +
Installation
Usage
koa-proxy-middleware
is used to forward HTTP requests in koa middleware,it looks like the nginx in Node.
example:
const Koa = require('koa');
const Proxy = require('koa-proxy-middleware');
const app = new Koa();
const proxy = new Proxy({
proxies: [
{
host: 'http://localhost:3333/',
context: 'nginx'
},
]
});
app.use(proxy);
app.listen(3000);
API
Options
-
proxies
koa-proxy-middleware
config option,expectArray
value,Each of the config objects is a proxy combination,you should fill this option with client requirecontext
prefix andhost
server address.host
url string to be parsed with the url modulecontext
Local proxy root address,required,string formatrewrite
unrequired,Function
/Boolean
value. It doesn't overwrite the path when it's false.proxyTimeout
unrequired,Number
-
proxyTimeout
timeout(in millis) for outgoing proxy requests. unrequired,default 30000 -
rewrite
rewrite the url redirects function.unrequired,default() => path.replace(context, '')
.It's unnecessary to replace '/' path because funcitonrewrite
did it default in http-proxy -
logLevel
Log level of terminal output,includeserror
,warn
,info
,http
,verbose
,debug
,debug
,silly
, it dependence on Winston package -
handleReq
The function will be triggered before send data. you can modify the request object of request before handle proxy.This method takes four argumentsproxyReq
,req
,res
,options
1const proxy = new Proxy({
2 proxies: ...,
3 handleReq: proxyObj => {
4 { proxyReq, req, res, options } = proxyObj;
5 }
6});
-
handleRes
The function will be triggered if back response from the target server.It takes three argumentsproxyRes
,req
,res
-
error
The error function will be triggered when fail in request to the target server.It takes three argumentserr
,req
,res
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: License:0
- Info: FSF or OSI recognized license: MIT License: License:0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/27 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 5 are checked with a SAST tool
Score
3
/10
Last Scanned on 2024-12-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More