pub struct Route {
pub matcher: RouteMatch,
pub filters: Vec<String>,
pub upstream: Option<String>,
pub backends: Vec<Backend>,
pub strip_prefix: Option<String>,
pub rate_limit: Option<RouteRateLimit>,
pub upgrade: Option<RouteUpgrade>,
pub compression: Option<RouteCompression>,
}Expand description
One routing rule (ADR 000013 / 000034): match a request by the [route.match] dimensions, run
an inline chain of filters, and forward to a single upstream (shorthand) or a weighted set of
backends (traffic split / canary). strip_prefix is a host-native path rewrite applied to
the forwarded request only (the chain still sees the original path) — the common reverse-proxy
prefix-strip, without a plecto:filter contract change. filters / strip_prefix / rate_limit
are per-route: they apply identically across every backend (ADR 000034 keeps a backend a pure
{upstream, weight} pair; a route needing different policy per target uses a separate route).
Fields§
§matcher: RouteMatchThe match dimensions ([route.match]): host / path_prefix / method / headers / query (ADR
000034). At least path_prefix is required; all other dimensions are optional and ANDed.
filters: Vec<String>This route’s chain: filter ids run in order (may be empty for a pure pass-through route).
upstream: Option<String>Single-upstream shorthand: the [[upstream]] name to forward a passing request to.
Mutually exclusive with backends (exactly one is required; validated at build). A single
upstream is normalised to a one-element weighted set (weight 1) at compile time.
backends: Vec<Backend>Weighted traffic split (ADR 000034): forward to these {upstream, weight} backends in
proportion to their weights (canary). Mutually exclusive with upstream. Empty unless used.
strip_prefix: Option<String>If set and the forwarded path starts with it, strip it before forwarding to the upstream
(host-native rewrite; the chain saw the original path). E.g. /api + /api/x → /x.
rate_limit: Option<RouteRateLimit>Native fast-path rate limit (ADR 000033): a coarse token-bucket baseline consulted BEFORE
this route’s filter chain. Absent = unlimited (the default). Distinct from the per-filter
host-ratelimit capability (ADR 000026): this is the operator’s native floor on a route
(or per client-IP), needs no WASM filter, and never crosses the WASM boundary.
upgrade: Option<RouteUpgrade>HTTP/1.1 Upgrade opt-in (ADR 000048): the Upgrade tokens this route tunnels. Absent = deny-by-default (the Upgrade/Connection pair keeps being stripped as hop-by-hop).
compression: Option<RouteCompression>Native response compression opt-in (ADR 000074 / 000075): negotiate a content coding against the
client’s Accept-Encoding and compress eligible responses AFTER the response chain
(filters always see identity). Absent = never transform — deny-by-default, which is also
the per-route BREACH opt-out. Do not enable on routes that reflect secrets into the
response body (CSRF tokens, session nonces echoed from the request): compression + reflection
enables BREACH-class chosen-plaintext attacks against TLS. Leave those routes uncompressed.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Route
impl<'de> Deserialize<'de> for Route
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for Route
impl JsonSchema for Route
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreAuto Trait Implementations§
impl Freeze for Route
impl RefUnwindSafe for Route
impl Send for Route
impl Sync for Route
impl Unpin for Route
impl UnsafeUnpin for Route
impl UnwindSafe for Route
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more