Package Exports
- reverse-proxy-node
- reverse-proxy-node/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (reverse-proxy-node) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Reverse Proxy Node
Reverse proxy CLI tool written in JavaScript with RegExp mapping
Install:
npm install -g reverse-proxy-nodeyarn global add reverse-proxy-node
Example of usage:
reverse-proxy
/\.(jpg)|(png)$/=cdn.com | Every .png and .jpg is served from cdn.com
/^/api/=:8080 | /api => localhost:8080
/^//=:5173 | Everything else => localhost:5173
--key privkey.pem
--ca chain.pem
--cert cert.pem
--port 443Programmatic usage:
import RevProxy from 'reverse-proxy-node';
// OR
const RevProxy = require('reverse-proxy-node');
RevProxy({
port: 443,
key: 'privkey.pem',
ca: 'chain.pem',
cert: 'cert.pem',
rules: {
'/\.(jpg)|(png)$/': {
address: 'cdn.com',
},
'/^/api/': {
port: 8080,
},
'/^//': {
port: 5173,
},
},
});Options:
- port:
| --port | -p Default: 443 - key:
| --key - cert:
| --cert - ca:
| --ca - serverOpts: net.ServerOpts [Only programmatic usage]
- rules:
CLI: /RegExp/=address:port OR /RegExp/=address OR /RegExp/=:port
Programmatic: {
'/RegExp/': {
address: 'URL', // Default 127.0.0.1
port: <number> // Default 443
}
}