Installations
npm install koa-proxies-better
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
14.20.0
NPM Version
8.19.1
Releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
Download Statistics
Total Downloads
355
Last Day
2
Last Week
3
Last Month
7
Last Year
107
GitHub Statistics
161 Stars
91 Commits
45 Forks
3 Watching
3 Branches
14 Contributors
Bundle Size
28.63 kB
Minified
10.33 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.0.1
Package Id
koa-proxies-better@1.0.1
Unpacked Size
9.93 kB
Size
4.31 kB
File Count
8
NPM Version
8.19.1
Node Version
14.20.0
Total Downloads
Cumulative downloads
Total Downloads
355
Last day
0%
2
Compared to previous day
Last week
50%
3
Compared to previous week
Last month
-22.2%
7
Compared to previous month
Last year
2.9%
107
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
2
Peer Dependencies
1
Koa Proxies
Koa@2.x/next middlware for http proxy
Powered by http-proxy
.
Installation
1$ npm install koa-proxies --save
Options
http-proxy events
1options.events = { 2 error (err, req, res) { }, 3 proxyReq (proxyReq, req, res) { }, 4 proxyRes (proxyRes, req, res) { } 5}
log option
1// enable log
2options.logs = true; // or false
3
4// custom log function
5options.logs = (ctx, target) {
6 console.log('%s - %s %s proxy to -> %s', new Date().toISOString(), ctx.req.method, ctx.req.oldPath, new URL(ctx.req.url, target))
7}
Usage
1// dependencies 2const Koa = require('koa') 3const proxy = require('koa-proxies') 4const httpsProxyAgent = require('https-proxy-agent') 5 6const app = new Koa() 7 8// middleware 9app.use(proxy('/octocat', { 10 target: 'https://api.github.com/users', 11 changeOrigin: true, 12 agent: new httpsProxyAgent('http://1.2.3.4:88'), // if you need or just delete this line 13 rewrite: path => path.replace(/^\/octocat(\/|\/\w+)?$/, '/vagusx'), 14 logs: true 15}))
Attention
Please make sure that koa-proxies
is in front of koa-bodyparser
to avoid this issue 55
1const Koa = require('koa') 2const app = new Koa() 3const proxy = require('koa-proxies') 4const bodyParser = require('koa-bodyparser') 5 6app.use(proxy('/user', { 7 target: 'http://example.com', 8 changeOrigin: true 9})) 10 11app.use(bodyParser())
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns 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 existing vulnerabilities detected
Reason
Found 8/26 approved changesets -- score normalized to 3
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/vagusX/koa-proxies/node.js.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/vagusX/koa-proxies/node.js.yml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/node.js.yml:29
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 1 out of 2 npmCommand dependencies pinned
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/node.js.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
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
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 20 are checked with a SAST tool
Score
4.2
/10
Last Scanned on 2024-12-16
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