This project is a Node.js reverse proxy server that forwards HTTP requests to upstream servers based on configurable rules. It supports multiple workers for handling concurrent requests and can follow redirects.
This project's system design is inspired from NGINX's design.
- Reverse proxy HTTP requests to upstream servers
- Configurable routing rules
- Supports multiple workers for concurrency
- Handles redirects automatically
- Properly processes and forwards response data and headers
- Node.js (v20 or higher)
- pnpm
- Clone the repository:
git clone https://github.com/yogeshbhutkar/node-reverse-proxy.git
cd node-reverse-proxy
- Install dependencies:
pnpm install
The proxy server is configured using a config.yaml file. Here is an example configuration:
server:
listen: 8080
workers: 4
upstreams:
- id: node1
url: jsonplaceholder.typicode.com
rules:
- path: /
upstreams:
- node1
- Start the proxy server:
pnpm run dev
- The server will start listening on the configured port (e.g.,
http://localhost:8080
).
To test the proxy server, you can use curl
or any HTTP client:
curl http://localhost:8080/posts
Note: This is just a prototype inspired from NGINX server and is not meant for production use.