MiddlewareSpec

Struct MiddlewareSpec 

Source
pub struct MiddlewareSpec {
Show 25 fields pub add_prefix: Option<MiddlewareAddPrefix>, pub basic_auth: Option<MiddlewareBasicAuth>, pub buffering: Option<MiddlewareBuffering>, pub chain: Option<MiddlewareChain>, pub circuit_breaker: Option<MiddlewareCircuitBreaker>, pub compress: Option<MiddlewareCompress>, pub content_type: Option<MiddlewareContentType>, pub digest_auth: Option<MiddlewareDigestAuth>, pub errors: Option<MiddlewareErrors>, pub forward_auth: Option<MiddlewareForwardAuth>, pub grpc_web: Option<MiddlewareGrpcWeb>, pub headers: Option<MiddlewareHeaders>, pub in_flight_req: Option<MiddlewareInFlightReq>, pub ip_allow_list: Option<MiddlewareIpAllowList>, pub ip_white_list: Option<MiddlewareIpWhiteList>, pub pass_tls_client_cert: Option<MiddlewarePassTlsClientCert>, pub plugin: Option<BTreeMap<String, Value>>, pub rate_limit: Option<MiddlewareRateLimit>, pub redirect_regex: Option<MiddlewareRedirectRegex>, pub redirect_scheme: Option<MiddlewareRedirectScheme>, pub replace_path: Option<MiddlewareReplacePath>, pub replace_path_regex: Option<MiddlewareReplacePathRegex>, pub retry: Option<MiddlewareRetry>, pub strip_prefix: Option<MiddlewareStripPrefix>, pub strip_prefix_regex: Option<MiddlewareStripPrefixRegex>,
}
Expand description

MiddlewareSpec defines the desired state of a Middleware.

Fields§

§add_prefix: Option<MiddlewareAddPrefix>

AddPrefix holds the add prefix middleware configuration. This middleware updates the path of a request before forwarding it. More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/addprefix/

§basic_auth: Option<MiddlewareBasicAuth>

BasicAuth holds the basic auth middleware configuration. This middleware restricts access to your services to known users. More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/basicauth/

§buffering: Option<MiddlewareBuffering>

Buffering holds the buffering middleware configuration. This middleware retries or limits the size of requests that can be forwarded to backends. More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/buffering/#maxrequestbodybytes

§chain: Option<MiddlewareChain>

Chain holds the configuration of the chain middleware. This middleware enables to define reusable combinations of other pieces of middleware. More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/chain/

§circuit_breaker: Option<MiddlewareCircuitBreaker>

CircuitBreaker holds the circuit breaker configuration.

§compress: Option<MiddlewareCompress>

Compress holds the compress middleware configuration. This middleware compresses responses before sending them to the client, using gzip, brotli, or zstd compression. More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/compress/

§content_type: Option<MiddlewareContentType>

ContentType holds the content-type middleware configuration. This middleware exists to enable the correct behavior until at least the default one can be changed in a future version.

§digest_auth: Option<MiddlewareDigestAuth>

DigestAuth holds the digest auth middleware configuration. This middleware restricts access to your services to known users. More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/digestauth/

§errors: Option<MiddlewareErrors>

ErrorPage holds the custom error middleware configuration. This middleware returns a custom page in lieu of the default, according to configured ranges of HTTP Status codes. More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/errorpages/

§forward_auth: Option<MiddlewareForwardAuth>

ForwardAuth holds the forward auth middleware configuration. This middleware delegates the request authentication to a Service. More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/forwardauth/

§grpc_web: Option<MiddlewareGrpcWeb>

GrpcWeb holds the gRPC web middleware configuration. This middleware converts a gRPC web request to an HTTP/2 gRPC request.

§headers: Option<MiddlewareHeaders>

Headers holds the headers middleware configuration. This middleware manages the requests and responses headers. More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/headers/#customrequestheaders

§in_flight_req: Option<MiddlewareInFlightReq>

InFlightReq holds the in-flight request middleware configuration. This middleware limits the number of requests being processed and served concurrently. More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/inflightreq/

§ip_allow_list: Option<MiddlewareIpAllowList>

IPAllowList holds the IP allowlist middleware configuration. This middleware limits allowed requests based on the client IP. More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/ipallowlist/

§ip_white_list: Option<MiddlewareIpWhiteList>

Deprecated: please use IPAllowList instead.

§pass_tls_client_cert: Option<MiddlewarePassTlsClientCert>

PassTLSClientCert holds the pass TLS client cert middleware configuration. This middleware adds the selected data from the passed client TLS certificate to a header. More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/passtlsclientcert/

§plugin: Option<BTreeMap<String, Value>>

Plugin defines the middleware plugin configuration. More info: https://doc.traefik.io/traefik/plugins/

§rate_limit: Option<MiddlewareRateLimit>

RateLimit holds the rate limit configuration. This middleware ensures that services will receive a fair amount of requests, and allows one to define what fair is. More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/ratelimit/

§redirect_regex: Option<MiddlewareRedirectRegex>

RedirectRegex holds the redirect regex middleware configuration. This middleware redirects a request using regex matching and replacement. More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/redirectregex/#regex

§redirect_scheme: Option<MiddlewareRedirectScheme>

RedirectScheme holds the redirect scheme middleware configuration. This middleware redirects requests from a scheme/port to another. More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/redirectscheme/

§replace_path: Option<MiddlewareReplacePath>

ReplacePath holds the replace path middleware configuration. This middleware replaces the path of the request URL and store the original path in an X-Replaced-Path header. More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/replacepath/

§replace_path_regex: Option<MiddlewareReplacePathRegex>

ReplacePathRegex holds the replace path regex middleware configuration. This middleware replaces the path of a URL using regex matching and replacement. More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/replacepathregex/

§retry: Option<MiddlewareRetry>

Retry holds the retry middleware configuration. This middleware reissues requests a given number of times to a backend server if that server does not reply. As soon as the server answers, the middleware stops retrying, regardless of the response status. More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/retry/

§strip_prefix: Option<MiddlewareStripPrefix>

StripPrefix holds the strip prefix middleware configuration. This middleware removes the specified prefixes from the URL path. More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/stripprefix/

§strip_prefix_regex: Option<MiddlewareStripPrefixRegex>

StripPrefixRegex holds the strip prefix regex middleware configuration. This middleware removes the matching prefixes from the URL path. More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/stripprefixregex/

Implementations§

Source§

impl MiddlewareSpec

Source

pub fn builder() -> MiddlewareSpecBuilder<((), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ())>

Create a builder for building MiddlewareSpec. On the builder, call .add_prefix(...)(optional), .basic_auth(...)(optional), .buffering(...)(optional), .chain(...)(optional), .circuit_breaker(...)(optional), .compress(...)(optional), .content_type(...)(optional), .digest_auth(...)(optional), .errors(...)(optional), .forward_auth(...)(optional), .grpc_web(...)(optional), .headers(...)(optional), .in_flight_req(...)(optional), .ip_allow_list(...)(optional), .ip_white_list(...)(optional), .pass_tls_client_cert(...)(optional), .plugin(...)(optional), .rate_limit(...)(optional), .redirect_regex(...)(optional), .redirect_scheme(...)(optional), .replace_path(...)(optional), .replace_path_regex(...)(optional), .retry(...)(optional), .strip_prefix(...)(optional), .strip_prefix_regex(...)(optional) to set the values of the fields. Finally, call .build() to create the instance of MiddlewareSpec.

Trait Implementations§

Source§

impl Clone for MiddlewareSpec

Source§

fn clone(&self) -> MiddlewareSpec

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 MiddlewareSpec

Source§

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

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

impl Default for MiddlewareSpec

Source§

fn default() -> MiddlewareSpec

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for MiddlewareSpec

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 MiddlewareSpec

Source§

fn schema_name() -> String

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 is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
Source§

impl PartialEq for MiddlewareSpec

Source§

fn eq(&self, other: &MiddlewareSpec) -> 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 MiddlewareSpec

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 MiddlewareSpec

Auto Trait Implementations§

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

Source§

impl<T> Instrument for T

Source§

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

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

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
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.
Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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

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