Skip to main content

HoopConfig

Enum HoopConfig 

Source
pub enum HoopConfig {
Show 20 variants RateLimit { window: Duration, max: u64, burst: Option<u64>, }, ForwardAuth { url: String, copy_headers: Vec<String>, }, Encode { encodings: Vec<String>, level: Option<u32>, }, Headers(HeadersConfig), BasicAuth { users: Vec<BasicAuthUser>, brute_force_max: Option<u32>, brute_force_window: Option<Duration>, }, IpFilter { allow: Vec<String>, deny: Vec<String>, forwarded_for: bool, }, Rewrite { strip_prefix: Option<String>, uri: Option<String>, regex_rules: Vec<(String, String)>, if_not_file: bool, if_not_dir: bool, root: Option<String>, normalize_slashes: bool, }, Replace { rules: Vec<(String, String)>, once: bool, }, Cache(CacheConfig), Templates { root: Option<String>, }, BufferLimit { max_request_body: Option<usize>, max_response_body: Option<usize>, }, Cors { allow_origins: Vec<String>, allow_methods: Vec<String>, allow_headers: Vec<String>, allow_credentials: bool, expose_headers: Vec<String>, max_age: Option<u64>, }, Timeout { duration: Duration, }, RequestId { header_name: Option<String>, overwrite: bool, }, ForceHttps { https_port: Option<u16>, }, TrailingSlash { action: String, }, Decompress { max_size: Option<usize>, }, ErrorPages { pages: HashMap<u16, String>, }, StreamReplace { rules: Vec<(String, String)>, once: bool, }, Module { name: String, config: HashMap<String, String>, },
}
Expand description

Supported middleware configurations.

Variants§

§

RateLimit

Fields

§window: Duration
§max: u64
§burst: Option<u64>

Maximum burst capacity (token bucket ceiling). Defaults to max when not specified.

§

ForwardAuth

Fields

§url: String

URL of the authentication service to delegate to.

§copy_headers: Vec<String>

Headers from the auth response to copy into the original request.

§

Encode

Fields

§encodings: Vec<String>
§level: Option<u32>
§

Headers(HeadersConfig)

§

BasicAuth

Fields

§brute_force_max: Option<u32>

Maximum number of consecutive failures before an IP is locked out. Defaults to 5 when None.

§brute_force_window: Option<Duration>

Duration of the lockout period after exceeding brute_force_max. Defaults to 300 seconds when None.

§

IpFilter

Fields

§allow: Vec<String>
§deny: Vec<String>
§forwarded_for: bool

When true, use the first IP in the X-Forwarded-For header instead of the direct client address.

§

Rewrite

Fields

§strip_prefix: Option<String>
§regex_rules: Vec<(String, String)>

Regex rewrite rules: list of (pattern, replacement) pairs applied sequentially to the path.

§if_not_file: bool

Only rewrite when the resolved path does NOT correspond to an existing file on disk (requires root).

§if_not_dir: bool

Only rewrite when the resolved path does NOT correspond to an existing directory on disk (requires root).

§root: Option<String>

Filesystem root used by if_not_file / if_not_dir checks.

§normalize_slashes: bool

When true, collapse consecutive slashes in the path before applying any other rewrite rules (e.g. //foo///bar/foo/bar).

§

Replace

Fields

§rules: Vec<(String, String)>

List of (search, replacement) pairs applied to the response body.

§once: bool

If true, only replace the first occurrence of each search string.

§

Cache(CacheConfig)

§

Templates

Fields

§

BufferLimit

Fields

§max_request_body: Option<usize>

Maximum allowed request body size in bytes. Returns 413 when exceeded.

§max_response_body: Option<usize>

Maximum allowed response body size in bytes. Returns 502 when exceeded.

§

Cors

Fields

§allow_origins: Vec<String>

Allowed origins. Use ["*"] to allow any origin.

§allow_methods: Vec<String>

Allowed HTTP methods. Use ["*"] to allow any method.

§allow_headers: Vec<String>

Allowed request headers. Use ["*"] to allow any header.

§allow_credentials: bool

Whether to allow credentials (cookies, authorization headers).

§expose_headers: Vec<String>

Headers to expose to the browser.

§max_age: Option<u64>

How long (in seconds) the preflight response can be cached.

§

Timeout

Fields

§duration: Duration

Maximum duration for a request before returning 503.

§

RequestId

Fields

§header_name: Option<String>

Header name for the request ID. Defaults to "x-request-id".

§overwrite: bool

Whether to overwrite an existing request ID. Defaults to true.

§

ForceHttps

Fields

§https_port: Option<u16>

HTTPS port to redirect to. If not set, uses the default (443).

§

TrailingSlash

Fields

§action: String

Action: "add" or "remove".

§

Decompress

Fields

§max_size: Option<usize>

Maximum decompressed body size in bytes. Prevents decompression bombs.

§

ErrorPages

Fields

§pages: HashMap<u16, String>

Maps HTTP status code to custom body content.

§

StreamReplace

Fields

§rules: Vec<(String, String)>

List of (search, replacement) pairs applied to the streaming response body.

§once: bool

If true, only replace the first occurrence of each search string.

§

Module

A module-provided middleware loaded via the plugin system.

Fields

§name: String

Module name (matches a registered ModuleLoader).

§config: HashMap<String, String>

Module-specific configuration as key-value pairs.

Trait Implementations§

Source§

impl Clone for HoopConfig

Source§

fn clone(&self) -> HoopConfig

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 HoopConfig

Source§

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

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

impl Serialize for HoopConfig

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

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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> 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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