HF Cloud
Docs / Load balancers

Load balancers

Highly available load balancers with HTTP, HTTPS (free Let's Encrypt certificates), TCP passthrough, health checks, weights and the web shield.

A load balancer is a managed pair of nodes on different hosts sharing one public address (VIP). If a node fails, the other takes over within seconds. It sends traffic to your servers over the private network, so it needs one in the same location, and it is enabled by support for your organization.

Create one in Network → Load balancers or with POST /load-balancers.

Listeners

A listener is a public port, a protocol and the port on your servers. Up to 10 listeners.

Protocol What it does
http HTTP proxy: sets X-Forwarded-For and X-Real-IP to the visitor's address (a value the client sent is replaced, never kept) and X-Forwarded-Proto, applies the web shield
https terminates TLS (HTTP/2 and HTTP/1.1) with a certificate for your domains, forwards plain HTTP to the servers
tcp plain TCP; use it for passthrough (for example port 443 with TLS ending on your servers), databases or other protocols
{
  "name": "web",
  "listeners": [
    {"port": 80,  "protocol": "http",  "target_port": 80, "redirect_https": true},
    {"port": 443, "protocol": "https", "target_port": 80}
  ],
  "targets": ["<server uuid>", {"server": "<server uuid>", "weight": 50}],
  "health": {"path": "/healthz", "interval": 5},
  "domains": ["www.example.com", "example.com"]
}

Listener options

In the console under Settings → Configuration, Options on each rule; in the API on each listener:

  • idle_timeout (5–3600 seconds, default 60): a connection with no traffic in either direction for this long is closed. WebSockets on HTTP and HTTPS listeners stay open while idle for up to an hour.
  • sticky: sticky sessions. HTTP and HTTPS: the load balancer sets a cookie (sticky_cookie, default HFLB) and keeps each visitor on the same server while it is healthy. TCP: connections from the same client address go to the same server (remembered for 30 minutes after the last one). A server with weight 0 keeps its sticky visitors.
  • proxy_protocol: send the PROXY protocol v2 header to your servers, so they learn the visitor's address also for TCP. Your servers must accept it on that port first (nginx listen 443 ssl proxy_protocol;, HAProxy accept-proxy), otherwise every connection and the health check fail.

Balancing (algorithm, for the whole load balancer): roundrobin (default, in turn by weight), leastconn (the server with the fewest connections; good for long requests and WebSockets) or source (the same client address always goes to the same server).

Configuration changes are applied without dropping connections: the new configuration takes over the listening sockets, and connections that were open finish on the old one (for at most 5 minutes).

HTTPS with Let's Encrypt

  • Add up to 10 domain names; each must have an A record pointing to the load balancer's address before the certificate is requested (the name is checked in DNS).
  • The certificate is free, issued by Let's Encrypt (HTTP-01 challenge through the load balancer) and renewed automatically 30 days before it expires.
  • redirect_https: true on the HTTP listener redirects HTTP to HTTPS (in the console: Settings → Configuration, Redirect to HTTPS on the HTTP rule).
  • New domain names must already point here when you save them; otherwise the change is refused (nothing saved).
  • Request a certificate again after a DNS change: Request certificate, or POST /load-balancers/{id}/certificate.
  • A current certificate keeps serving while it is renewed or while one for new names is requested, and after a failed renewal (the console shows active, renewal failed with the reason).
  • Limits: your organization can request 5 certificates per hour and 20 per day (new names, Request certificate, Renew now; automatic renewals do not count). Over the limit the request is refused with the time to wait. When the platform as a whole is busy, a request waits in the queue and is issued later by itself.
  • TLS 1.2 or newer by default (TLS 1.3 minimum as an option), Mozilla's intermediate ciphers.

Targets, weights and standby

Targets are your servers in the private network of the same location.

  • Weight 0 to 256 (default 100): active servers share traffic by weight. Weight 0 takes no new connections (maintenance).
  • Standby (backup: true): gets traffic only when no active server passes its health check (active/passive).
  • At least one server must be active with a weight above 0.

Health checks

  • HTTP and HTTPS listeners check a path with GET (health.path, default /) and expect a status from 200 to 399 (an HTTPS listener with a certificate talks plain HTTP to your servers, so it is checked the same way).
  • TCP listeners check that the port accepts connections; with health.tcp_check http or https they are checked with an HTTP request instead (https: over TLS, for passthrough servers; the certificate is not verified).
  • health.interval is 2 to 60 seconds (default 5).
  • health.host: the Host header the check sends (the site your servers answer for); empty: none. A new load balancer with HTTPS domains uses the first domain.
  • health.method: GET (default) or HEAD; health.expect_status: a status (200) or a range (200-399, the default).
  • health.timeout: 1 to 30 seconds for an answer (default: the check interval).
  • health.rise / health.fall: checks in a row before a server counts as healthy (default 2) or failed (default 3).
  • health.port: check another port of the servers (for example a separate status port); default: the listener's server port.
"health": {"path": "/healthz", "host": "www.example.com", "expect_status": "200", "interval": 5, "fall": 2}

The console shows each server's state with the reason when it fails, for example "answers HTTP 403" (a default web server page without index.html), "connection refused" (nothing listening, or the server's firewall) or "no answer". Remember that your security groups must allow the load balancer: traffic arrives from its private address.

Web shield and WAF

The Security tab (or PATCH /load-balancers/{id} with security) protects HTTP(S) listeners.

Included:

  • security headers (X-Content-Type-Options, X-Frame-Options, Referrer-Policy) when your application does not send them, and optional HSTS;
  • slow-request (Slowloris) protection;
  • allow list and block list (IPv4/IPv6 addresses or networks, up to 500 each);
  • per-visitor limits: normal (200 requests per 10 s, 100 open connections), strict (50 / 20) or custom; over the limit visitors get 429;
  • block typical scans (/.env, /.git, /wp-login.php, ...), maximum request body size, a basic attack filter.

Web shield (priced on the pricing page):

  • country filtering: only selected countries, or block selected ones;
  • OWASP WAF: the OWASP Core Rule Set (Coraza), in detection only or blocking mode, paranoia level 1 or 2; optionally fail closed (503 when the WAF cannot check a request);
  • bot check: a lightweight JavaScript proof-of-work challenge for clients that request pages too fast or without a User-Agent. It stops simple bots, not a determined attacker with a real browser.

Blocked visitors get a plain 403 page. The console shows what was stopped in the last hour.

Operations

  • Configuration state: apply_state (API) and Settings show whether both nodes loaded the configuration: writing, waiting, applied, or rejected – a node refused it and keeps running the previous one; the page shows the node's error and Apply again (in_sync only means written to both nodes).

  • Editing at the same time: when someone else saved the same settings after you opened the page, your save is refused with a message instead of overwriting their change; reload and make your change again.

  • Make active moves the address to the chosen node after a short delay (about 15 seconds), so a node that just started does not take the address before it is ready.

  • A server being restored from a backup stays in the load balancer; the health check takes it out until it answers again.

  • Upgrade: when a new appliance version is available, Upgrade rebuilds one node at a time (the other keeps serving); settings, weights, certificate and address stay. It takes 5 to 10 minutes and interrupts open connections once.

  • Change public IP (owners; Settings, or POST /load-balancers/{id}/change-ip with the name as confirm): a new address, e.g. when the old one is being retired (an amber notice says so). Both nodes switch without a restart and answer on both addresses for about 24 hours (previous.works_until): point your DNS records to the new address before then. Certificates are issued for your domain names, so they stay valid; renewals work once DNS points to the new address. Then the old address stops (Remove old address now ends it earlier). A one-off fee applies, free while the address is being retired. When the load balancer's network has no free address (e.g. the new range is on another network), it moves to another network: the nodes restart one after the other there (standby first, each gets a new own address), the address switches over once (a few seconds, open connections are cut), and the old address keeps working through a temporary second network card until the grace period ends.

  • Delete (owners): removes both nodes and releases the address; your servers stay.