This project is developed as a personal endeavor for educational purposes. It is not intended for production environments or critical applications. The author makes no representations or warranties regarding the functionality, security, or suitability of this software for any particular purpose. Users are advised to assess the software's suitability for their needs and use it at their own risk. The author shall not be held liable for any damages or issues arising from the use of this software.
This lightweight Node.js application functions as a reverse proxy, serving as the public-facing interface to route requests to a target service. It effectively masks the target service's IP, aiding in bypassing IP-based restrictions.
- 🔄 Efficient Request Routing: Forwards incoming HTTP requests to the designated backend service.
- 🕵️♂️ IP Obfuscation: Conceals the actual IP address of the target service, enhancing accessibility.
- ⚡ Lightweight: Minimal resource usage, ensuring swift and reliable performance.
sequenceDiagram
participant Client
participant ReverseProxy
participant TargetServer
Client->>ReverseProxy: HTTP Request
ReverseProxy->>TargetServer: Forward Request
TargetServer-->>ReverseProxy: Response
ReverseProxy-->>Client: Forward Response
- 🌐 Node.js: Ensure Node.js is installed on your system. Download it from nodejs.org.
-
Clone the Repository:
git clone https://github.com/brkcoc02/reverse-proxy.git
-
Navigate to the Project Directory:
cd reverse-proxy -
Install Dependencies:
npm install
You can configure the application using either environment variables or a .env file:
Define the following environment variables to configure the application:
- 🌐
TARGET_URL: The URL of the target service to which requests will be proxied. - 🔢
PORT: The port number on which the proxy server will listen.
For example, in a Unix-based environment:
export TARGET_URL='http://your-target-service.com'
export PORT=3000- 📝 Create a
.envfile in the project root directory - 📝 Add your configuration:
TARGET_URL=http://your-target-service.com
PORT=3000
🔒 Note: The .env file is ignored by Git for security. Use the provided .env.example as a template.
🌐 For deployment platforms like render.com, configure these environment variables in your deployment platform's dashboard.
-
Start the Proxy Server:
You can start the server using either of the following commands:
-
Using npm:
npm start
-
Directly with Node.js:
node index.js
Ensure that the
startscript in yourpackage.jsonis correctly configured if you choose to usenpm start. -
-
Access the Proxy:
🌐 Direct your client applications to the proxy server's address (e.g.,
http://localhost:3000) to have requests forwarded to the target service.
Contributions are welcome! Please follow these steps:
- 🍴 Fork the repository.
- 🌿 Create a new branch for your feature or bug fix.
- 📝 Commit your changes with clear and descriptive messages.
- ⬆️ Push your changes to the branch.
- 🔄 Submit a pull request detailing your changes.
📜 This project is licensed under the MIT License. See the LICENSE file for details.
📧 For questions or feedback, please open an issue in the repository or contact brkcoc02@gmail.com.
