HTTP reverse proxy implementation based on Node.js and Docker.
rproxy
is based on fast-gateway
and is a ready to use Docker container image for implementing reverse proxies or API Gateways.
module.exports = {
middlewares: [
require('cors')()
],
routes: [{
prefix: '/api',
target: 'https://httpbin.org'
}, {
proxyType: 'websocket',
prefix: '/echo',
target: 'ws://ws.ifelse.io'
}]
}
docker run --rm -p 8080:8080 -v $(pwd)/config.js:/rproxy/src/config.js kyberneees/rproxy:latest
FROM kyberneees/rproxy:latest
COPY config.js ./src
PORT
: Indicates the running port of the HTTP server. Defaults to:8080
In order to use custom NPM modules, those have to be installed through your Dockerfile
. For example:
FROM kyberneees/rproxy:latest
RUN npm i morgan
Modules installed by default:
- cors: https://www.npmjs.com/package/cors
- http-cache-middleware: https://www.npmjs.com/package/http-cache-middleware