Routes
Routes map incoming request paths to backend clusters. Meridian uses prefix-based matching — the first route whose prefix matches the request path wins.
[[routes]]
prefix = "/api"
cluster = "api-backend"
timeout_ms = 15000
[[routes]]
prefix = "/static"
cluster = "cdn-backend"
[[routes]]
prefix = "/"
cluster = "default-backend"
Fields
| Field | Type | Required | Description |
|---|---|---|---|
prefix | string | yes | Path prefix to match |
cluster | string | yes | Target cluster name |
timeout_ms | integer | no | Request-level timeout in milliseconds |
retry_policy | table | no | Retry configuration |
Matching Order
Routes are evaluated in the order they appear in the configuration file. Put more specific prefixes first:
# Correct: specific routes first
[[routes]]
prefix = "/api/v2"
cluster = "api-v2"
[[routes]]
prefix = "/api"
cluster = "api-v1"
[[routes]]
prefix = "/"
cluster = "default"
Path Normalization
Before matching, request paths are normalized:
- Double slashes collapsed:
//api//databecomes/api/data - Dot segments resolved:
/api/../secretbecomes/secret - Dot segments removed:
/api/./databecomes/api/data - Traversal beyond root clamped:
/../../etc/passwdbecomes/etc/passwd
This prevents routing bypass attacks where an attacker uses path manipulation to reach unintended backends.
Retry Policy
[[routes]]
prefix = "/api"
cluster = "api-backend"
[routes.retry_policy]
num_retries = 3
retry_on = ["503", "connect-failure"]