Route

Struct Route 

Source
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: String

Name 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: bool

Require 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.

§authorization: Option<Authz>

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: bool

Opt 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 Clone for Route

Source§

fn clone(&self) -> Route

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Route

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Route

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for Route

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl PartialEq for Route

Source§

fn eq(&self, other: &Route) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Route

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl 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§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AnyExt for T
where T: Any + ?Sized,

§

fn downcast_ref<T>(this: &Self) -> Option<&T>
where T: Any,

Attempts to downcast this to T behind reference
§

fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>
where T: Any,

Attempts to downcast this to T behind mutable reference
§

fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>
where T: Any,

Attempts to downcast this to T behind Rc pointer
§

fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>
where T: Any,

Attempts to downcast this to T behind Arc pointer
§

fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>
where T: Any,

Attempts to downcast this to T behind Box pointer
§

fn downcast_move<T>(this: Self) -> Option<T>
where T: Any, Self: Sized,

Attempts to downcast owned Self to T, useful only in generic context as a workaround for specialization
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T, X> CoerceTo<T> for X
where 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

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> ServiceExt for T

§

fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>
where Self: Sized,

Apply a transformation to the response body. Read more
§

fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using HTTP status codes. Read more
§

fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using gRPC headers. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> TryIntoValue for T
where T: Serialize,

§

type Error = SerializationError

§

fn try_into_value(self) -> Result<Value, <T as TryIntoValue>::Error>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,