Routing schema
The shape of a routing rule. A condition (path / method / NF type / SUPI range / time window and more) decides when the rule fires; a single target decides where the request goes, with weighting, failover, and sticky-session controls.
Top-level shape
A RoutingRule pairs a flat condition object with a single target object. A rule is ignored unless enabled is true.
Every matcher in condition is optional; an empty matcher is a wildcard. A request matches a rule only when all populated matchers pass. The Diameter matchers (diameter_apps, command_codes, origin_realms / origin_hosts / destination_realms / destination_hosts) and the common SBI matchers are shared with the policy and rate-limit schemas — see Policy schema.
Evaluation
- Only rules with
enabled: trueare evaluated. They are ordered bypriorityascending (lowest first); ties break bynameascending so the decision is deterministic across restarts and replicas. The first matching rule wins. - If no rule matches, the proxy falls back to the producer pool — NRF-discovered producers for the request's NF type.
- If neither produces a target, the request is rejected with the appropriate protocol-level error (
503on SBI,DIAMETER_UNABLE_TO_DELIVERon Diameter).
Condition fields
path_patterns, methods, NF types
path_patterns is a list of glob-style path patterns (not a bare prefix); methods is a list of HTTP methods. NF type matching is split into source_nf_types (the consumer) and target_nf_types (the producer NF type the request is bound for) — there is no single nf_type condition field.
supi_ranges
A list of SupiRangeConfig entries. Each entry is either a numeric range (start + end) or a pattern (pattern). Use a pattern for "all SUPIs in PLMN 001/01"; use a range to carve a contiguous SUPI block out for a tenant.
time_windows
A list of TimeWindow entries. The rule's time condition passes when the current time falls inside any window. Outside every window the rule does not match and the engine falls through to the next rule. Useful for maintenance windows that route around a producer at a fixed time, or for off-peak routing changes.
timezone— IANA timezone name. DefaultUTC.days_of_week— full day names (Monday…Sunday). Three-letter abbreviations are rejected by validation. Empty means all days.start_time/end_time—HH:MM, both required.
start_time and strictly before end_time, so a
window with start_time later than end_time matches nothing.
Split an overnight window into two rules (one ending at 23:59, one starting
at 00:00).header_match, body_field_match
header_match matches request header values by name; body_field_match matches dotted JSON body field paths. Both are exact-match string maps where every entry must match.
RoutingTarget
A rule has exactly one target. Addresses live under producers (weighted round-robin across endpoints) or weighted_targets (a canary / percentage split). A target must specify at least one of nf_type, producers, or weighted_targets.
- nf_type — when set without explicit endpoints, the request is routed to the NRF-discovered pool for that NF type.
- producers — a list of
{address, weight}endpoints selected by weighted random choice.addressis a producer URL (SBI) or Diameter peer URI. A non-positiveweightis coerced to1, so a weight of0still receives traffic — it does not drain a producer. - weighted_targets — a list of
{address, weight}for a canary or percentage split. Eachweightmust be1–100and the set must sum to exactly100; validation rejects anything else. - sticky_key — the field used to pin a flow to one target. Configurable across six values:
supi,gpsi,imsi,session_id,origin_host,request_id. The extracted value is looked up in a TTL-bounded sticky store; a hit reuses the prior target, otherwise a fresh selection is made and stored. (This is a TTL store keyed by the extracted value, not consistent hashing.) - sticky_ttl — required when
sticky_keyis set, and must be greater than zero. Duration string, e.g."300s". - failover — fallback producers engaged when the primary target fails.
trigger_on_statuslists HTTP status codes that trigger SBI failover;trigger_on_result_codelists Diameter Result-Code values that turn an otherwise-successful answer into a failover trigger (e.g.3002DIAMETER_UNABLE_TO_DELIVER);max_retriescaps re-attempts.failover.producersis required whenfailoveris set.
Examples
Canary 5%
SUPI shard
Maintenance window
Diameter realm route
Realm-based Diameter routing lives under the diameter.routes[] config block, independent of the routing-rule CRUD documented here: the routing engine is for content-based picking, while Diameter realm routes ship with the rest of the Diameter config. See Config schema.
Where to go next
- Routing engine — how rules are evaluated.
- Admin API → Routing — managing rules over the admin API.
- NRF and producers — pool-based fallback.