pub struct Config {
pub enabled: Vec<Encoding>,
pub min_size: usize,
pub gzip_level: u32,
pub brotli_level: u32,
pub deflate_level: u32,
pub zstd_level: i32,
pub stream: bool,
pub content_types: ContentTypePolicy,
pub protect_sensitive: bool,
}plugins only.Expand description
Configuration settings for HTTP response compression.
Fields§
§enabled: Vec<Encoding>List of enabled compression encodings in preference order.
min_size: usizeMinimum response size in bytes required for compression to be applied.
gzip_level: u32Gzip compression level (1-9, where 9 is maximum compression).
brotli_level: u32Brotli compression level (1-11, where 11 is maximum compression).
deflate_level: u32DEFLATE compression level (1-9, where 9 is maximum compression).
zstd_level: i32zstd only.Zstandard compression level (1-22, where 22 is maximum compression).
stream: boolWhether to use streaming compression instead of buffering entire responses.
content_types: ContentTypePolicyWhich response content types are eligible for compression.
protect_sensitive: boolWhen true (default), responses that look like they carry authenticated
secrets (Set-Cookie present, or the request had Authorization /
Proxy-Authorization / Cookie) are not compressed. This is the
canonical CRIME / BREACH mitigation. Disable explicitly with
CompressionBuilder::protect_sensitive when you have other
mitigations (e.g. per-response random padding or rotated CSRF tokens).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Config
impl !UnwindSafe for Config
impl Freeze for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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