
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
koa-server-http-proxy
Advanced tools
A koa2 http-proxy-middleware.
$ npm install koa-server-http-proxy --save
const Koa = require('koa')
const app = new Koa()
const proxy = require('koa-server-http-proxy')
app.use(proxy('/api', {
target: 'https://news-at.zhihu.com',
pathRewrite: { '^/api': 'api/4/' },
changeOrigin: true
}))
app.listen(3000)
http://127.0.0.1:3000/api/themes
const Koa = require('koa')
const app = new Koa()
const proxy = require('koa-server-http-proxy')
const proxyTable = {
'/json': {
target: 'http://jsonplaceholder.typicode.com',
pathRewrite: { '^/json': '' },
changeOrigin: true
},
'/api': {
target: 'https://news-at.zhihu.com',
pathRewrite: { '^/api': 'api/4/' },
changeOrigin: true
}
}
Object.keys(proxyTable).forEach((context) => {
var options = proxyTable[context]
app.use(proxy(context, options))
})
app.listen(3000)
All options are passed to http-proxy-middleware
, except that if options is passed
as a string, it will normalized as options' target.
See http-proxy-middleware for full list of accepted options.
MIT
FAQs
A koa2 http-proxy-middleware.
The npm package koa-server-http-proxy receives a total of 2,374 weekly downloads. As such, koa-server-http-proxy popularity was classified as popular.
We found that koa-server-http-proxy demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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 uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.