Gathering detailed insights and metrics for koa-proxy
Gathering detailed insights and metrics for koa-proxy
Gathering detailed insights and metrics for koa-proxy
Gathering detailed insights and metrics for koa-proxy
npm install koa-proxy
Typescript
Module System
Node Version
NPM Version
89.4
Supply Chain
89.9
Quality
69.8
Maintenance
50
Vulnerability
97.3
License
JavaScript (100%)
Total Downloads
4,007,337
Last Day
398
Last Week
15,252
Last Month
64,697
Last Year
672,223
45 Stars
78 Commits
19 Forks
2 Watchers
2 Branches
1 Contributors
Updated on Dec 02, 2024
Minified
Minified + Gzipped
Latest Version
1.0.0-alpha.3
Package Id
koa-proxy@1.0.0-alpha.3
Size
3.26 kB
NPM Version
6.10.1
Node Version
10.16.0
Published on
Jul 23, 2019
Cumulative downloads
Total Downloads
Last Day
-44.5%
398
Compared to previous day
Last Week
-12.2%
15,252
Compared to previous week
Last Month
9.4%
64,697
Compared to previous month
Last Year
54.3%
672,223
Compared to previous year
3
1
8
Proxy middleware for koa
$ npm install koa-proxy -S
When you request http://localhost:3000/index.js, it will fetch http://alicdn.com/index.js and return.
1var koa = require('koa'); 2var proxy = require('koa-proxy'); 3var app = koa(); 4app.use(proxy({ 5 host: 'http://alicdn.com' 6})); 7app.listen(3000);
You can proxy a specified url.
1app.get('index.js', proxy({ 2 url: 'http://alicdn.com/index.js' 3}));
You can specify a key/value object that can map your request's path to the other.
1app.get('index.js', proxy({ 2 host: 'http://alicdn.com', 3 map: { 4 'index.js': 'index-1.js' 5 } 6}));
You can specify a function that can map your request's path to the desired destination.
1app.get('index.js', proxy({ 2 host: 'http://alicdn.com', 3 map: function(path) { return 'public/' + path; } 4}));
You can specify match criteria to restrict proxy calls to a given path.
1app.use(proxy({ 2 host: 'http://alicdn.com', // proxy alicdn.com... 3 match: /^\/static\// // ...just the /static folder 4}));
Or you can use match to exclude a specific path.
1app.use(proxy({ 2 host: 'http://alicdn.com', // proxy alicdn.com... 3 match: /^(?!\/dontproxy\.html)/ // ...everything except /dontproxy.html 4}));
Proxy won't send cookie to real server, you can set jar = true
to send it.
1app.use(proxy({ 2 jar: true, 3}));
Proxy won't send 'foo' and 'bar' headers to real server, or recieve 'jar-jar' from real server.
1app.use(proxy({ 2 suppressRequestHeaders: ['foo','bar'], // case-insensitive 3 suppressResponseHeaders: ['jar-jar'] // case-insensitive 4}));
You can also add new headers to your response or override existing ones
1app.use(proxy({ 2 overrideResponseHeaders: { 3 "cow": "moo", 4 "duck": "quack" 5 }, 6}));
Copyright (c) 2014 popomore. Licensed under the MIT license.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 4/26 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
20 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
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