pub struct MiddlewareConfig {Show 14 fields
pub rate_limit: Option<RateLimitConfig>,
pub cache: Option<CacheConfig>,
pub auth: Option<AuthConfig>,
pub rewrite_request: Vec<RewriteRuleConfig>,
pub rewrite_response: Vec<RewriteRuleConfig>,
pub ip_allow: Vec<String>,
pub ip_deny: Vec<String>,
pub timeout_ms: Option<u64>,
pub max_body_size: Option<u64>,
pub wasm: Option<WasmConfig>,
pub early_hints: Vec<String>,
pub authz: Option<RouteAuthzConfig>,
pub mirror: Option<MirrorConfig>,
pub waf: Option<WafSettings>,
}Fields§
§rate_limit: Option<RateLimitConfig>§cache: Option<CacheConfig>§auth: Option<AuthConfig>§rewrite_request: Vec<RewriteRuleConfig>§rewrite_response: Vec<RewriteRuleConfig>§ip_allow: Vec<String>§ip_deny: Vec<String>§timeout_ms: Option<u64>timeout_ms — if the route (including all its other middleware)
doesn’t produce a response within this many milliseconds, the client
gets 504 Gateway Timeout instead of waiting further. See
crate::timeout for the underlying mechanism and its limitations.
max_body_size: Option<u64>max_body_size — reject this route’s request with 413 Payload Too Large if its body exceeds this many bytes.
This is a route-specific ceiling on top of the global, process-wide
RWS_CONFIG_MAX_BODY_SIZE_IN_BYTES (see crate::entry_point::get_max_body_size)
— e.g. a small JSON API route can be capped stricter than a
file-upload route without lowering the global limit for everyone.
It is not a substitute for the global limit: by the time any
route-level middleware runs, Request (including its body) has
already been fully read off the socket — route matching itself
requires the complete request, so a per-route check can only run
after that memory is already spent, not before. The global limit is
what protects total server memory from an oversized upload;
max_body_size protects only this route’s own logic/upstream from
an oversized-but-still-within-the-global-limit body.
wasm: Option<WasmConfig>[route.middleware.wasm]: a WebAssembly plugin (feature
wasm-plugins, 18.10.0).
early_hints: Vec<String>early_hints = ["</app.css>; rel=preload; as=style", …]: Link
values sent as a 103 Early Hints before the route answers (18.12.0).
authz: Option<RouteAuthzConfig>[route.middleware.authz]: the caller needs relation on object.
Since 18.14.0.
mirror: Option<MirrorConfig>[route.middleware.mirror]: copy a share of requests to other
backends (18.11.0).
waf: Option<WafSettings>[route.middleware.waf] (18.22.0): the web application firewall.
Implementations§
Trait Implementations§
Source§impl Clone for MiddlewareConfig
impl Clone for MiddlewareConfig
Source§impl Debug for MiddlewareConfig
impl Debug for MiddlewareConfig
Auto Trait Implementations§
impl Freeze for MiddlewareConfig
impl RefUnwindSafe for MiddlewareConfig
impl Send for MiddlewareConfig
impl Sync for MiddlewareConfig
impl Unpin for MiddlewareConfig
impl UnsafeUnpin for MiddlewareConfig
impl UnwindSafe for MiddlewareConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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