Security News
Research
Supply Chain Attack on Rspack npm Packages Injects Cryptojacking Malware
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
reverse-proxy-server
Advanced tools
开发用的node.js反向代理reverse-proxy工具
主要作用是在node环境下完成http请求的代理,更多考虑的是反向代理,正向代理http-proxy本身就可以比较轻松的配置。 这样实现了js对反向代理的直接控制,方便开发过程(没有验证过性能和可靠性,不能使用到生产中)。
模块引入时的配置文件,直接使用js代码
module.exports = {
'http': {
listen: 80,
defaultTarget: 'http://127.0.0.1:8083',
ssl: false,
httpOptions: {
},
proxyOptions: {
},
messageHandler: function () {},
proxyHandler: function () {},
proxyTable: [
{
origin: /example.http.com/,
target: 'http://127.0.0.1:8082'
},
{
origin: /example.http.com/,
target: 'http://127.0.0.1:8083'
}
]
},
'https': {
listen: 443,
defaultTarget: 'http://127.0.0.1:8082',
ssl: true,
httpOptions: {
},
proxyOptions: {
},
messageHandler: function () {},
proxyHandler: function () {},
proxyTable: [
{
origin: /example1.https.com/,
target: 'http://127.0.0.1:8082'
},
{
origin: /example2.https.com/,
target: 'http://127.0.0.1:8083'
}
]
}
}
主文件
var proxy = require('../src')
var configs = require('../config')
proxy(configs)
命令行的执行命令为 rps (reverse proxy server)
rps start // 按照配置命令启动服务器(目前只有这一个命令)
命令行config文件,使用config-master解析配置文件,名称为‘.reverse-proxy.json’
{
"http": {
"listen": 80,
"defaultTarget": "http://127.0.0.1:8083",
"ssl": false,
"httpOptions": {
},
"proxyOptions": {
},
"proxyTable": [
{
"origin": "example1.com",
"target": "http://127.0.0.1:8082"
},
{
"origin": "example2.com",
"target": "http://127.0.0.1:8083"
}
]
},
"https": {
"listen": 443,
"defaultTarget": "http://127.0.0.1:8082",
"ssl": true,
"httpOptions": {
},
"proxyOptions": {
},
"proxyTable": [
{
"origin": "example1.com",
"target": "http://127.0.0.1:8082"
},
{
"origin": "example2.com",
"target": "http://127.0.0.1:8083"
}
]
}
}
性能不能和Nginx、Apache比拟,性能重要时,可以尝试Nginx配置js化——https://www.npmjs.com/package/nginx-conf
FAQs
一个JavaScript的反向代理实现;方便开发过程
The npm package reverse-proxy-server receives a total of 4 weekly downloads. As such, reverse-proxy-server popularity was classified as not popular.
We found that reverse-proxy-server 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.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.
Security News
Sonar’s acquisition of Tidelift highlights a growing industry shift toward sustainable open source funding, addressing maintainer burnout and critical software dependencies.