{{define "content"}} {{with .Data}} {{if .Note}}

{{.Note}}

{{end}} {{range .Services}}

{{.Name}} {{if not $.Data.Note}}{{if not .Running}}not applied{{else if .Up}}up{{else}}down{{end}}{{end}}

Listens on
port {{.Port}} in {{.Zones}}
TLS
{{if eq .TLS "terminate"}}decrypted on the router{{else if eq .TLS "passthrough"}}passed through{{else}}none{{end}}, {{.Protocol}}
{{if .Hosts}}
Names
{{.Hosts}}
{{end}}
Balancing
{{.Balance}}
{{if .Servers}} {{range .Servers}}{{end}}
BackendAddressStateLast checkConnectionsIn this state
{{.Name}}{{.Address}} {{if .Up}}{{.Status}}{{else}}{{.Status}}{{end}} {{.Check}}{{.Current}} now, {{.Total}} in all{{.Since}} s
{{else if .Running}}

HAProxy has no backend for it.

{{end}}
{{else}}

No load balancer is set up. A load balancer spreads the connections to a service over several hosts and leaves out a host that fails its checks. Add one under router.loadBalancers in Advanced, for example:

"loadBalancers": {
  "api": {
    "listen": { "port": 8443, "zones": ["wan", "lan"] },
    "tls": "terminate",
    "hosts": ["api.example.org"],
    "backends": ["hv1", "hv2"],
    "backendTls": { "enable": true },
    "check": { "path": "/healthz" }
  }
}

The backends are names of DHCP reservations or addresses. With "tls": "passthrough" the backends keep their certificate and the router only forwards; the client's address then reaches them with "proxyProtocol": true (if they read it). Saved changes take effect when you apply them.

{{end}} {{end}} {{end}}