← All guides
pdf
Self-Hosted Reverse Proxy Blueprint
Route, secure, and monitor all your services
Build a production reverse proxy from scratch in Node.js. Not an nginx tutorial — a custom proxy that gives you full control over routing, TLS, rate limiting, and observability for multi-app hosting on a single server.
// at a glance
- ▸ 35+ pages with complete, working code
- ▸ Based on a proxy currently routing 20+ subdomains in production
- ▸ Full TLS/SNI implementation — not just theory
- ▸ Includes rate limiting, ACME, and security hardening
// who this is for
Developers who host multiple apps on one server and want full control over their routing layer. You should know basic Node.js and understand HTTP.
// table of contents
01
Why Build Your Own
When nginx/Caddy isn't enough — the case for a programmable proxy
02
HTTP & HTTPS Servers
Node.js http/https modules, listening on 80/443, and the request lifecycle
03
Hostname Routing
Host header parsing, hostMap configuration, and subdomain-based routing
04
TLS & SNI
Server Name Indication, per-domain certificates, and the SNI callback pattern
05
Let's Encrypt Automation
ACME challenge handling, certbot integration, and automatic renewal
06
Path-Based Routing
Split architectures, API vs frontend routing, and WebSocket upgrades
07
Rate Limiting
Per-IP bucketing, endpoint-specific limits, and the sliding window pattern
08
Security Headers
HSTS, CSP, X-Frame-Options, and defense-in-depth at the proxy layer
09
Error Handling & Logging
502 pages, proxy timeouts, request logging, and debugging routing issues
10
Production Deployment
Systemd service, log rotation, zero-downtime restarts, and monitoring