https://github.com/banktnbd/reverse-proxy
Reverse proxy server from Node.js
https://github.com/banktnbd/reverse-proxy
http net nodejs reverse-proxy-server tcp-server
Last synced: 10 months ago
JSON representation
Reverse proxy server from Node.js
- Host: GitHub
- URL: https://github.com/banktnbd/reverse-proxy
- Owner: BankTNBD
- Created: 2025-02-02T04:23:40.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-07T05:16:16.000Z (about 1 year ago)
- Last Synced: 2025-06-10T10:59:57.606Z (10 months ago)
- Topics: http, net, nodejs, reverse-proxy-server, tcp-server
- Language: JavaScript
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🌐 reverse proxy
Reverse proxy server usign Node.js.
## 👨🏻💻 Authors
- [@BankTNBD](https://github.com/BankTNBD)
## 🛠️ Configuration
Before starting the server, there are a few steps you need to complete.
**1️⃣ Setup .env file:**
```
SSL_KEY="PATH/TO/SSL_KEY"
SSL_CERT="PATH/TO/SSL_CERTIFICATE"
```
**2️⃣ Setup list.json file:**
```json
[
{
"name": "",
"protocol": "",
"port": 8000,
"host": [ "HOSTNAME" ],
"forward": {
"address": "HOSTNAME",
"port": 8000
}
},
]
```
- ```name``` (optional): Before starting the server, there are a few steps you need to complete.
- ```protocol```: Canba ```http```, ```https``` or ```tcp```.
- ```port```: The port on which the reverse proxy listens.
- ```host```: An array of hostnames that the proxy should handle.
- ```forward```: The destination server details.
Example:
```json
[
{
"name": "Chat Server",
"protocol": "tcp",
"port": 8000,
"host": [ "your.domain.com", "www.domain.com", "my.domain.com" ],
"forward": {
"address": "your-server.local",
"port": 3000
}
},
{
"protocol": "https",
"port": 8001,
"host": [ "domain.com" ],
"forward": {
"address": "your-web-server.local",
"port": 3000
}
},
{
"protocol": "tcp",
"port": 8002,
"host": "*",
"forward": {
"address": "your-web-db.local",
"port": 3000
}
}
]
```
Explaination:
- Requests to ```your.domain.com:8000```, ```www.domain.com:8000```, or ```my.domain.com:8000``` will be forwarded to ```your-server.local:3000``` over TCP.
- Requests to ```domain.com:8001``` over HTTPS will be forwarded to ```your-web-server.local:3000``` over HTTP.
- Requests to every doamin in port ```:8002``` will be forwarded to ```your-web-db.local:3000``` over TCP.
## 🚀 Running the Server
After cloning this project, follow these steps:
**1️⃣ Navigate to the project directory:**
```bash
cd reverse-proxy
```
**2️⃣ Install dependencies:**
```bash
npm install
```
**3️⃣ Start the server:**
```bash
npm start
```