pub struct Route {Show 32 fields
pub name: String,
pub service: String,
pub match: RouteMatch,
pub action: RouteAction,
pub policies: Vec<String>,
pub priority: Option<u8>,
pub auth_required: bool,
pub cors: Option<Cors>,
pub compression: Option<Compression>,
pub limits: Option<RequestLimits>,
pub authorization: Option<Authz>,
pub deprecation: Option<Deprecation>,
pub maintenance: Option<Maintenance>,
pub transforms: Option<Transforms>,
pub security_headers: Option<SecurityHeaders>,
pub security_headers_opt_out: bool,
pub masking: Option<Masking>,
pub cache: Option<RouteCache>,
pub methods: Vec<String>,
pub slo: Option<RouteSlo>,
pub websocket: Option<RouteWebsocket>,
pub waf: Option<RouteWaf>,
pub graphql: Option<RouteGraphql>,
pub grpc_web: Option<GrpcWeb>,
pub translation: Option<Translation>,
pub request_validation: Option<RequestValidation>,
pub openapi: Option<OpenApiMeta>,
pub mirror: Option<MirrorConfig>,
pub fault_injection: Option<FaultInjection>,
pub plugins: Vec<String>,
pub filter_chain: Option<FilterChainConfig>,
pub oidc_login: Option<OidcLoginConfig>,
}Expand description
Match rules (path/host/method/header) plus action and attached policies.
Fields§
§name: String§service: StringName of the service this route targets.
match: RouteMatch§action: RouteAction§policies: Vec<String>Attached policy names. All applicable levels’ rules AND together (see the rate-limiter module docs); the resolution order is consumer > route > service > listener > global.
priority: Option<u8>Request priority class for load shedding (DW-016): 0 (lowest) to 10
(highest); absent means the default 5. When the gateway concurrency
cap is saturated, requests at high_priority (>= 8) draw from a
small reserved sub-allowance of the cap that lower-priority traffic
cannot use (see proxy module docs); preemption is impossible, so
normal traffic is shed first rather than displaced. Validation
rejects values above 10.
auth_required: boolRequire authenticated requests (DW-019): a request that arrives
WITHOUT a recognized credential (or with an invalid one) is
rejected with 401 and a WWW-Authenticate challenge. Absent
(the default) allows anonymous traffic through; note that an
INVALID presented credential is always rejected with 401
regardless of this flag.
cors: Option<Cors>Route-scoped CORS policy (DW-027, feature analysis 4.14): controls
how the gateway answers browser cross-origin requests on this
route. When present, a CORS PREFLIGHT (OPTIONS carrying both
Origin and Access-Control-Request-Method) is answered by the
gateway itself, before authentication and never forwarded
upstream; actual (non-preflight) responses carry the policy’s
CORS headers. Non-CORS requests are untouched. A preflight on a
route whose match.methods list excludes OPTIONS never matches
the route (the documented request-path order applies first) —
include OPTIONS in the method list of CORS routes.
compression: Option<Compression>Route-scoped response compression (DW-027, feature analysis 4.13):
negotiates gzip/brotli/zstd against the request’s Accept-Encoding
and compresses the response body per policy. Streaming-safe: the
body is compressed chunk-by-chunk with a per-chunk flush, never
buffered whole. Disabled (absent) by default — the dataplane
forwards bytes untouched.
limits: Option<RequestLimits>Route-scoped request size limits (DW-027, feature analysis 4.16):
per-route body and header caps enforced after route resolution.
Over-limit requests are rejected by the gateway with the JSON
error envelope (413 for bodies, 431 for headers) before any
upstream contact when the size is declared up front
(Content-Length); streaming bodies of unknown length are
aborted as soon as they cross the cap.
Route-level authorization rules (DW-020, feature analysis 4.7).
Absent (the default) imposes no authorization on the route. A
PRESENT-but-entirely-empty block (no consumers, groups, scopes,
claims, or ip_acl) is likewise a no-op at evaluation time —
it imposes nothing, exactly like an absent one — but it is
always a config-authoring mistake (a rule block with no rules),
so validation REJECTS it: omit the block instead of emptying it.
When present (and non-empty), the rules are evaluated after
authentication and BEFORE
rate limiting; see Authz for the rule semantics. Presence of
any identity rule implies authentication (an anonymous request is
rejected 401); an ip_acl-only block is the one case that can
permit anonymous access (from an allowed IP). Precedence across
levels (consumer > route > service > listener > global) is
resolved by the authz module’s resolver; every level has a
config attachment point (consumers[].authorization,
services[].authorization, listeners[].authorization, and the
gateway-level authorization).
deprecation: Option<Deprecation>API deprecation policy (DW-048): emits the standard deprecation
signal headers on this route’s responses. See Deprecation.
maintenance: Option<Maintenance>Route maintenance mode (DW-041): when present, every request the
route matches is answered by the GATEWAY with a 503 carrying
Retry-After and the JSON error envelope (maintenance code) —
before route limits, CORS preflight handling (preflights
themselves are exempt, see Maintenance), authentication, and
the route action (proxy, redirect, and respond actions alike
never run). Toggled by config reload like every route field:
publish a generation with the block to enter maintenance and one
without it to leave. See Maintenance.
transforms: Option<Transforms>Request/response transforms (DW-028, feature analysis 4.12):
header and query manipulation on the forwarded request and the
route’s responses, plus the size-capped JSON-pointer body
transform — the transforms surface’s ONE explicitly buffering
piece. Absent (the default): bytes and headers flow untouched.
See Transforms.
security_headers: Option<SecurityHeaders>Security-header injection (DW-028, feature analysis 5-Security):
HSTS, X-Content-Type-Options: nosniff,
Content-Security-Policy, and X-Frame-Options, stamped on
EVERY response the route emits (action responses and gateway
short-circuits alike), replacing any upstream-sent values — the
gateway is the source of truth at its edge. See
SecurityHeaders.
security_headers_opt_out: boolOpt out of the gateway-level default_security_headers
baseline (SEC-09, #213): when true, a route with no
security_headers block ships WITHOUT the gateway’s default
security headers. A route that carries its own
security_headers block always uses it (the block fully
replaces the default); this flag is for the rare route that
deliberately needs no security headers at all. Default:
false (inherit the default when present).
masking: Option<Masking>Response field masking (DW-029, feature analysis 5-Security):
redacts the named RFC 6901 JSON pointers from the route’s
responses — the floor fields for every consumer, plus the
groups additions for members of each consumer group — before
any other body-handling stage. The redaction is fail-closed: a
response the gateway cannot prove clean (encoded, non-JSON,
over the cap, unparseable, or missing a configured pointer)
answers 502, never a passthrough. See Masking.
cache: Option<RouteCache>Route-scoped response caching (DW-037, feature analysis
5-Protocol): opts the route’s cacheable GET traffic into the
local response cache behind the CacheStore extension seam.
Absent (the default): responses are never cached or buffered.
The cache key folds in the route, the consumer, the inbound
path + query, and the effective vary set — masked (DW-029) and
consumer-group-specific variants never cross consumers. Stored
bodies are the POST-masking/transform bytes (replay consistency
under route-scoped policies), stored identity (never compressed;
compression re-negotiates per request), and the decoration tail
(compression onward) re-runs on every replay. See
RouteCache and dataplane::response_cache.
methods: Vec<String>Per-route METHOD ALLOWLIST (DW-030): when non-empty, a request
that resolved this route but whose method is not in the list is
answered by the gateway with 405 Method Not Allowed plus an
Allow header listing the configured methods (RFC 9110 10.2.1).
Distinct from match.methods, which gates ROUTE RESOLUTION (a
miss falls through to 404 / other routes); this list gates the
ALREADY-matched route. Placement (frozen): after route
resolution and the maintenance 503, before the route limits and
CORS preflight short-circuit and authentication — the allowlist
is a statement about the route, not the request’s shape (the
DW-041 maintenance ordering argument), and a CORS PREFLIGHT
(OPTIONS + preflight markers) is exempt exactly like the
maintenance 503 (the preflight asks about the GATEWAY’s
cross-origin policy, not the resource; failing it would hide the
CORS answer from the browser). Matching is case-insensitive, the
same comparison match.methods uses. HEAD is NOT implicitly
granted by GET — a route supporting HEAD alongside GET lists
both (the allowlist is exhaustive by design; implicit grants
would leak methods the operator never named). Empty (the
default) allows every method, exactly like pre-DW-030.
slo: Option<RouteSlo>Service-level objectives (DW-052, feature analysis 4.17): the
route’s availability target and optional latency objective,
exported as dwara_slo_burn_rate / dwara_slo_target metrics
over process-local 5m and 1h sliding windows for multiwindow
burn-rate alerting. Availability counts a request BAD only when
the GATEWAY answers 5xx (client errors are the caller’s policy,
not this route’s availability). Absent (the default): the route
records nothing and exports no SLO series. See RouteSlo.
websocket: Option<RouteWebsocket>WebSocket policy (DW-039, feature analysis 4.13): origin
allowlisting before an upgrade is offered and post-upgrade
frame-rate policing on the tunneled connection. Absent (the
default): upgrades are transparent — any origin, unlimited
frame rate, the generic 101 tunnel unchanged. See
RouteWebsocket.
waf: Option<RouteWaf>WAF-lite heuristic filtering (DW-051): pattern-matching
inspection of the request path, query string, selected
headers, and body (when JSON or form-urlencoded) for common
SQL-injection, XSS, and path-traversal signatures. Absent (the
default): no inspection. When enabled is true, the WAF runs
after the route method allowlist and before the route limits —
a content filter that rejects malicious requests before any
resource is spent on auth or rate limiting. dry_run evaluates
and logs matches without blocking (audit-log-only mode). See
RouteWaf.
graphql: Option<RouteGraphql>GraphQL awareness (DW-099): query depth/complexity limits and
optional persisted-query enforcement for routes that front a
GraphQL server. When enabled, the gateway rejects abusive
queries before the route limits and authentication. Absent
(the default): no GraphQL checks. Compiled into every build
(no cargo feature). See RouteGraphql.
grpc_web: Option<GrpcWeb>gRPC-Web framing translation + JSON-to-gRPC transcoding (DW-101):
when enabled, the gateway translates gRPC-Web framing to native
gRPC for the upstream and wraps the response back. When
transcoding is enabled, JSON requests are translated to/from
protobuf using .proto descriptors supplied via config. Absent
(the default): no translation. The block parses and validates in
every build (no cargo feature); the runtime translation is
scaffolded and not yet dispatched from the request path. See
GrpcWeb.
translation: Option<Translation>Protocol translation (DW-100): translates the request/response
bodies between two wire protocols on this route’s forward and
response paths. When enabled, the gateway converts the client’s
body to the upstream’s wire format and the upstream’s response
back to the client’s wire format. Absent (the default): no
translation. The block parses and validates in every build (no
cargo feature); the runtime translation is scaffolded and not
yet dispatched from the request path.
See Translation.
request_validation: Option<RequestValidation>Request validation (DW-047): an optional JSON-schema block the
gateway validates the request body against before the route
action runs. A mismatch answers 400 validation_failed with the
offending paths in the JSON error envelope; a match proceeds to
the action (proxy, mock, …). This is a SIMPLER surface than
full OpenAPI parameter/header/query validation — it covers the
body only, the common case for write endpoints. The schema is a
minimal JSON-Schema subset (type, required, properties, items,
enum, minimum, maximum, minLength, maxLength); $ref is not
supported. See RequestValidation.
openapi: Option<OpenApiMeta>OpenAPI import metadata (DW-047): when this route was generated
by dwara import openapi, this block records the source
operation’s operationId, summary, and tags for
traceability. It has no runtime effect — the gateway ignores it
— but it survives round-trips so the operator can audit which
spec operation a route came from. Absent for hand-authored
routes.
mirror: Option<MirrorConfig>Shadow traffic mirroring (DW-062): fire-and-forget duplicate
requests to a mirror upstream. The mirror response is discarded
and never impacts the primary request’s latency. A percentage
controls sampling (0 = never, 100 = always). Absent (the
default): no mirroring. See MirrorConfig.
fault_injection: Option<FaultInjection>Fault injection (DW-062): percentage-based delays and aborts for
chaos testing. A delay injects a fixed latency before the
request is forwarded; an abort short-circuits with a configured
status without contacting the upstream. Both are sampled by
percentage (0 = never, 100 = always). Absent (the default): no
fault injection. See FaultInjection.
plugins: Vec<String>Plugin names to run on this route (DW-055). Each name must
reference a plugin defined in the top-level plugins list.
Plugins run in declaration order at their declared phases
(request-path dispatch, DW-157). Routes without plugins take
the untouched fast path.
filter_chain: Option<FilterChainConfig>SCALE-12 (#191): per-route filter-chain ordering and dry-run
overrides. When absent, the global filter_chain config (or
the default order) applies. See FilterChainConfig.
oidc_login: Option<OidcLoginConfig>SEC-05: OIDC browser login flow as a route auth mode. When
present, the gateway acts as an OIDC relying party: unauthenticated
browser requests are redirected to the IdP’s authorization
endpoint, and the callback (redirect_uri) exchanges the
authorization code for tokens, sets a session cookie, and
redirects the user back to the original URL. Subsequent requests
carry the session cookie (validated by the gateway). Absent (the
default): no browser login flow (the route uses its normal auth
mode). See OidcLoginConfig.
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 moreimpl StructuralPartialEq for Route
Auto Trait Implementations§
impl Freeze for Route
impl RefUnwindSafe for Route
impl Send for Route
impl Sync for Route
impl Unpin for Route
impl UnwindSafe for Route
Blanket Implementations§
§impl<T> AnyExt for T
impl<T> AnyExt for T
§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind reference§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable reference§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointer§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointer§fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
T behind Box pointer§fn downcast_move<T>(this: Self) -> Option<T>
fn downcast_move<T>(this: Self) -> Option<T>
Self to T,
useful only in generic context as a workaround for specializationSource§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, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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