The Dataplane v3 API accepts exactly ten balance algorithms. HAProxy UI exposes all ten in the backend inspector, and exposes the argument fields for the six that take arguments.
Algorithms
Algorithm | Arguments | Inspector fields | Emitted as |
|---|---|---|---|
| none | — |
|
| none | — |
|
| none | — |
|
| none | — |
|
| none | — |
|
| required | Hash sample expression |
|
| optional | Hash whole URI (toggle), URI length, URI depth |
|
| required | Header name |
|
| required | Parameter name, Check on POST, Max wait (ms) |
|
| required | Cookie name |
|
| optional | Draws |
|
Algorithms not in this list — alpha, cookie, map(<file>) — are not part of the v3 schema and are rejected by the API. They are deliberately absent from the dropdown rather than offered and then refused.
Hash type
When the algorithm is hash or uri, haproxy requires the backend to also declare a hash-type. Without it the apply is rejected with “balance hash requires a sample expression”-class errors.
The dropdown offers the seven values the v3 spec enumerates across hash_type.method, .function and .modifier:
Value | Spec slot | Notes |
|---|---|---|
|
| The haproxy default |
|
| Minimal remapping when servers join or leave — the usual choice for stickiness |
|
| Defends the hash map against chosen-key attacks |
|
| Hash function selection |
How
hash-typeis stored. The v3 spec models it as an object ({method, function, modifier}). HAProxy UI keeps the whole directive as a string instead. This is deliberate: the string form round-trips byte-stable through the parser and serializer, and the API accepts it. Splitting it into three fields would add a shape conversion that changes nothing a user can act on. Upgrade this only if the Dataplane ever rejects the string form.
How the fields behave
Fields appear on demand. Each argument field is hidden unless its algorithm is selected, so the backend inspector shows only the arguments that are meaningful for the current choice.
Clearing a field removes the argument. Emptying the header name on a
hdrbackend dropshdr_nameand the backend reverts to the barebalance hdrform — which haproxy will reject, deliberately, rather than silently invent a header.Switching algorithm keeps other arguments. Changing from
uritohashpreservesuri_wholein the model until it is explicitly cleared. This is intentional: the arguments are keyed independently of the algorithm, and dropping them silently on a dropdown change would lose work.
Troubleshooting
“balance hash requires a sample expression” — the hash expression field was left empty. Fill it in (for example req.uri).
“backend requires a hash-type” — set the hash type as well. Both fields are required together.
Apply succeeds but the config does not look right — check the raw-payload panel for a balance line carried verbatim from a paste-import; an unparsed directive will take precedence over the modelled one.