A powerful, enterprise-grade reverse proxy server with advanced routing, load balancing, and WebSocket support. Built with Node.js and designed for high-performance multi-domain hosting environments.
- Multi-Domain Routing: Route requests to different backends based on domain/subdomain
- WebSocket Support: Full WebSocket proxy support with Socket.IO compatibility
- Load Balancing: Multiple load balancing methods (round-robin, least-connections, IP-hash)
- SSL/TLS Support: HTTPS with automatic certificate generation
- Database-Driven Configuration: SQLite-based configuration management
- Health Monitoring: Automatic backend health checks and failover
- Caching: Built-in caching layer for improved performance
- Admin Panel: Web-based administration interface
- Cloudflare Integration: Automatic DNS and tunnel management
- Proxmox Integration: VM/Container discovery and management
- Authentication: JWT-based authentication system
- Request/Response Modification: Flexible middleware for header manipulation
- WebSocket Metrics: Real-time connection tracking and statistics
- Domain-Based Backend Pools: Isolated backend pools per domain
- Service Worker Isolation: Prevents cross-domain cache conflicts
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Client Requests β
ββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β RAWRProxy Server β
β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β Domain β β WebSocket β β Admin β β
β β Router β β Handler β β Panel β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β Backend β β Health β β Cache β β
β β Pools β β Checker β β Manager β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
ββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Backend Servers β
β β
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββ β
β β Immich β β Frigate β β Proxmox β β Apps β β
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Node.js 18+
- PM2 (for process management)
- SQLite3
- Clone the repository:
git clone https://github.com/yourusername/rawrproxy.git
cd rawrproxy- Install dependencies:
npm install- Configure environment variables:
cp .env.example .env
# Edit .env with your configuration- Initialize the database:
npm run db:init- Start the server:
# Development
npm run dev
# Production with PM2
npm run start:prodKey environment variables in .env:
# Server Configuration
PORT=80
HTTPS_PORT=443
ADMIN_PORT=8081
HTTPS_ENABLED=true
# Database
DATABASE_PATH=./data/proxy.db
# WebSocket
WEBSOCKET_ENABLED=true
# Logging
LOG_LEVEL=info
LOG_FILE_PATH=./logs/proxy.log
# Authentication
AUTH_ENABLED=false
JWT_SECRET=your-secret-key
# SSL Certificates
SSL_CERT_PATH=./certs/cert.pem
SSL_KEY_PATH=./certs/key.pemThe proxy uses SQLite with the following main tables:
domains: Root domain configurationssubdomains: Subdomain configurationsbackends: Backend server definitionsdomain_backends: Domain-to-backend mappingscloudflare_config: Cloudflare integration settingsproxmox_config: Proxmox integration settings
// Via Admin Panel: http://localhost:8081
// Or via database:
INSERT INTO domains (domain, active) VALUES ('example.com', 1);
INSERT INTO backends (name, url, active) VALUES ('app-server', 'http://192.168.1.100:3000', 1);
INSERT INTO domain_backends (domainId, backendId) VALUES (1, 1);For services like Immich that use Socket.IO:
UPDATE backends
SET ws_supported = 1,
ws_endpoint = '/api/socket.io/?EIO=4&transport=websocket'
WHERE name = 'immich-backend';GET /health
- Forward Proxy:
/proxy/forward?url=TARGET - Reverse Proxy:
/proxy/reverse - Auto Proxy: Automatic routing based on Host header
Access the admin panel at http://localhost:8081
- round_robin: Distributes requests evenly
- least_connections: Routes to backend with fewest connections
- ip_hash: Consistent routing based on client IP
- weighted: Distributes based on backend weights
- Ensure
WEBSOCKET_ENABLED=truein.env - Check backend WebSocket endpoint configuration
- Verify PM2 is running in fork mode (not cluster)
- The proxy automatically adds cache control headers
- Uses
Clear-Site-Dataheader when switching subdomains
- Check health check logs in
./logs/proxy.log - Verify backend URL and port
- Check firewall rules
Enable debug logging:
LOG_LEVEL=debugView logs:
# PM2 logs
pm2 logs rawr-proxy
# Application logs
tail -f ./logs/proxy.log/opt/proxy/
βββ src/
β βββ server.js # Main server entry
β βββ proxy/
β β βββ ProxyManager.js # Core proxy logic
β β βββ BackendPool.js # Load balancing
β β βββ RequestModifier.js # Request manipulation
β βββ auth/
β β βββ AuthManager.js # Authentication
β βββ admin/
β β βββ AdminPanel.js # Admin interface
β βββ database/
β β βββ Database.js # Database operations
β βββ websocket/
β β βββ WebSocketManager.js # WebSocket metrics
β βββ utils/
β βββ Logger.js # Logging utility
β βββ BackendHealthChecker.js
βββ data/
β βββ proxy.db # SQLite database
βββ logs/
β βββ proxy.log # Application logs
βββ certs/ # SSL certificates
βββ .env # Configuration
βββ package.json
βββ ecosystem.config.js # PM2 configuration
- Connection Pooling: Reuses HTTP agents for backend connections
- Proxy Instance Caching: Caches proxy middleware instances per domain
- Health Check Intervals: Configurable health check frequency
- Response Caching: Optional caching layer for GET requests
- WebSocket Connection Tracking: Efficient metrics collection
- JWT-based authentication (when enabled)
- Request rate limiting support
- Domain blocking capability
- HTTPS/TLS encryption
- Header sanitization
- XSS protection via Helmet.js
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
Solution: Fixed by properly isolating proxy instances per domain and handling WebSocket upgrades separately from HTTP proxy middleware.
Solution: Implemented cache control headers and Service Worker isolation per subdomain.
MIT License - See LICENSE file for details
For issues and questions:
- GitHub Issues: Create an issue
- Documentation: Check the
/docsfolder
Built with:
RAWRProxy - High-performance reverse proxy for modern web applications