Skip to content
Docs / dflux EdgeGuard
ContactGet started

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.

JSON

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: true are evaluated. They are ordered by priority ascending (lowest first); ties break by name ascending 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 (503 on SBI, DIAMETER_UNABLE_TO_DELIVER on 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.

JSON

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. Default UTC.
  • days_of_week — full day names (MondaySunday). Three-letter abbreviations are rejected by validation. Empty means all days.
  • start_time / end_timeHH:MM, both required.
Warning
A window does not wrap across midnight. The window matches only while the current time is at or after 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.

JSON
  • 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. address is a producer URL (SBI) or Diameter peer URI. A non-positive weight is coerced to 1, so a weight of 0 still receives traffic — it does not drain a producer.
  • weighted_targets — a list of {address, weight} for a canary or percentage split. Each weight must be 1100 and the set must sum to exactly 100; 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_key is set, and must be greater than zero. Duration string, e.g. "300s".
  • failover — fallback producers engaged when the primary target fails. trigger_on_status lists HTTP status codes that trigger SBI failover; trigger_on_result_code lists Diameter Result-Code values that turn an otherwise-successful answer into a failover trigger (e.g. 3002 DIAMETER_UNABLE_TO_DELIVER); max_retries caps re-attempts. failover.producers is required when failover is set.

Examples

Canary 5%

JSON

SUPI shard

JSON

Maintenance window

JSON

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