
Research
/Security News
10 npm Typosquatted Packages Deploy Multi-Stage Credential Harvester
Socket researchers found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.
@chuxingpay/koa-proxy-middleware
Advanced tools
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.
node v8.x +
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);
proxies
koa-proxy-middleware config option,expect Array value,Each of the config objects is a proxy combination,you should fill this option with client require context prefix and host 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,NumberproxyTimeout
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 funciton rewrite did it default in http-proxy
logLevel
Log level of terminal output,includes error, 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 arguments proxyReq,req,res,options
const proxy = new Proxy({
proxies: ...,
handleReq: proxyObj => {
{ proxyReq, req, res, options } = proxyObj;
}
});
handleRes
The function will be triggered if back response from the target server.It takes three arguments proxyRes,req,res
error
The error function will be triggered when fail in request to the target server.It takes three arguments err,req,res
FAQs
http proxy middleware of koa2
We found that @chuxingpay/koa-proxy-middleware demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Socket researchers found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.