Loading…
Loading documentation...
Distribute traffic across instances for reliability and scale.
Self-managed setup. A native managed load balancer product is planned and not yet available. This guide sets up HAProxy yourself across Linux VPS instances you check out.
Distribute incoming traffic across multiple instances using HAProxy for high availability and horizontal scaling.
┌─────────────┐
Internet ───▶ │ HAProxy LB │
└─────┬───────┘
│
┌─────────┴─────────┐
│ │
┌─────┴─────┐ ┌─────┴─────┐
│ Web App 1 │ │ Web App 2 │
└────────────┘ └────────────┘
All instances should share the same private network so the load balancer can reach the backends over private IPs.
What you can create today: Buy any product marked Available in checkout and it is set up automatically; products marked Coming soon have no checkout yet. The
sauCLI does not create instances.
Servers in one environment already share its private network. To reach the load balancer from the internet, add a port forward to it on Network > Public access, or give it its own Public IPv4 Address from the store. See Private Networking for details.
Deploy your application on both web-1 and web-2, listening on port 3000.
SSH into the load balancer instance:
apt update && apt install -y haproxy
cat > /etc/haproxy/haproxy.cfg <<'EOF'
global
log /dev/log local0
maxconn 4096
daemon
defaults
log global
mode http
option httplog
option dontlognull
option forwardfor
timeout connect 5s
timeout client 30s
timeout server 30s
retries 3
frontend http_front
bind *:80
bind *:443 ssl crt /etc/ssl/certs/combined.pem
redirect scheme https code 301 if !{ ssl_fc }
default_backend web_servers
backend web_servers
balance roundrobin
option httpchk GET /health
http-check expect status 200
server web1 WEB1_PRIVATE_IP:3000 check inter 5s fall 3 rise 2
server web2 WEB2_PRIVATE_IP:3000 check inter 5s fall 3 rise 2
listen stats
bind *:8404
stats enable
stats uri /stats
stats refresh 10s
stats admin if LOCALHOST
EOF
Replace WEB1_PRIVATE_IP and WEB2_PRIVATE_IP with the actual private IPs from your VPC.
apt install -y certbot
certbot certonly --standalone -d your-domain.com
# Combine for HAProxy
cat /etc/letsencrypt/live/your-domain.com/fullchain.pem \
/etc/letsencrypt/live/your-domain.com/privkey.pem \
> /etc/ssl/certs/combined.pem
haproxy -c -f /etc/haproxy/haproxy.cfg # Validate config
systemctl enable haproxy
systemctl restart haproxy
Ensure your application exposes a /health endpoint:
// Express example
app.get('/health', (req, res) => res.status(200).json({ status: 'ok' }));
HAProxy will automatically remove unhealthy backends and re-add them when they recover.
| Algorithm | Best For |
|---|---|
roundrobin |
Equal-capacity servers (default) |
leastconn |
Varying request durations |
source |
Session stickiness by client IP |
Access the HAProxy stats dashboard at http://LB_IP:8404/stats (restrict to your IP via firewall).
Every Servers Are Up virtual machine and container includes an integrated HTML5 browser-based SSH, RDP, and VNC console in your dashboard, default-off inbound firewall rules with per-IP allow-lists, and full programmatic control via REST API v1 and Model Context Protocol (MCP). Explore our Virtual Datacenter Plans or reach out to Servers Are Up Support.