ο»Ώ# DDoS Protection Proxy π‘οΈ
A lightweight, high-performance DDoS protection proxy with captcha and Under Attack Mode (UAM) challenges. This proxy sits in front of your origin server and helps protect against automated attacks and excessive traffic.
# Clone the repository
git clone https://github.com/denigkt/js-anti-ddos.git
# Install dependencies
cd js-anti-ddos
npm install
# Start the server
npm start
Create a .env
file in the root directory:
PORT=3000
ORIGIN_URL=https://your-origin-server.com
RPS_THRESHOLD=10
UAM_MODE=false
Option | Description | Default | Required |
---|---|---|---|
PORT |
Server port | 3000 | No |
ORIGIN_URL |
Origin server URL | https://api.example.com | Yes |
RPS_THRESHOLD |
Max requests per second per IP | 10 | No |
UAM_MODE |
Enable Under Attack Mode | false | No |
Request β Rate Limit Check β Challenge (if needed) β Origin Server
js-anti-ddos/
βββ config/
β βββ config.js
βββ src/
β βββ middleware/
β β βββ rateLimiter.js
β βββ services/
β β βββ captchaService.js
β βββ utils/
β β βββ inMemoryStore.js
β βββ server.js
βββ public/
β βββ css/
β βββ js/
βββ views/
β βββ captcha.html
β βββ uam.html
βββ package.json
βββ README.md
# Run in development mode
npm run dev
# Run tests
npm test
# Run with specific config
PORT=4000 RPS_THRESHOLD=5 npm start
Rate Limiting
CAPTCHA Protection
Under Attack Mode (WIP)
GET /captcha
- Generate CAPTCHA imagePOST /verify-captcha
- Verify CAPTCHA solutionPOST /verify-browser
- Browser verification (UAM mode)// Basic proxy setup
const express = require('express');
const app = express();
const { createProxyMiddleware } = require('http-proxy-middleware');
// Apply DDoS protection
app.use(rateLimiter);
// Proxy requests to origin
app.use('/', createProxyMiddleware({
target: config.ORIGIN_URL,
changeOrigin: true
}));
Memory Management
Security
Performance
This project is licensed under the MIT License - see the LICENSE file for details.
For support, please:
Made with β€οΈ by @denigkt