Skip to main content

HttpListenerConfig

Struct HttpListenerConfig 

Source
pub struct HttpListenerConfig {
Show 36 fields pub address: SocketAddress, pub public_address: Option<SocketAddress>, pub expect_proxy: bool, pub sticky_name: String, pub front_timeout: u32, pub back_timeout: u32, pub connect_timeout: u32, pub request_timeout: u32, pub active: bool, pub http_answers: Option<CustomHttpAnswers>, pub h2_max_rst_stream_per_window: Option<u32>, pub h2_max_ping_per_window: Option<u32>, pub h2_max_settings_per_window: Option<u32>, pub h2_max_empty_data_per_window: Option<u32>, pub h2_max_continuation_frames: Option<u32>, pub h2_max_glitch_count: Option<u32>, pub h2_initial_connection_window: Option<u32>, pub h2_max_concurrent_streams: Option<u32>, pub h2_stream_shrink_ratio: Option<u32>, pub h2_max_rst_stream_lifetime: Option<u64>, pub h2_max_rst_stream_abusive_lifetime: Option<u64>, pub h2_max_rst_stream_emitted_lifetime: Option<u64>, pub h2_max_header_list_size: Option<u32>, pub h2_stream_idle_timeout_seconds: Option<u32>, pub h2_max_header_table_size: Option<u32>, pub h2_graceful_shutdown_deadline_seconds: Option<u32>, pub h2_max_window_update_stream0_per_window: Option<u32>, pub sozu_id_header: Option<String>, pub answers: BTreeMap<String, String>, pub elide_x_real_ip: Option<bool>, pub send_x_real_ip: Option<bool>, pub h2_max_header_fields: Option<u32>, pub interface: Option<String>, pub forwarded_headers: Option<i32>, pub h2_stream_refusal_percent: Option<u32>, pub h2c_prior_knowledge: Option<bool>,
}
Expand description

details of an HTTP listener

Fields§

§address: SocketAddress§public_address: Option<SocketAddress>§expect_proxy: bool§sticky_name: String§front_timeout: u32

client inactive time, in seconds

§back_timeout: u32

backend server inactive time, in seconds

§connect_timeout: u32

time to connect to the backend, in seconds

§request_timeout: u32

max time to send a complete request, in seconds

§active: bool

wether the listener is actively listening on its socket

§http_answers: Option<CustomHttpAnswers>

DEPRECATED: per-status answer message. Prefer the answers map at field 31. Kept on the wire so legacy state files round-trip cleanly; workers populate both fields and treat them as equivalent on read.

§h2_max_rst_stream_per_window: Option<u32>

H2 flood detection thresholds (CVE mitigations). All are optional; when absent, built-in defaults are used. Maximum RST_STREAM frames per second window (CVE-2023-44487, CVE-2019-9514)

§h2_max_ping_per_window: Option<u32>

Maximum PING frames per second window (CVE-2019-9512)

§h2_max_settings_per_window: Option<u32>

Maximum SETTINGS frames per second window (CVE-2019-9515)

§h2_max_empty_data_per_window: Option<u32>

Maximum empty DATA frames per second window (CVE-2019-9518)

§h2_max_continuation_frames: Option<u32>

Maximum CONTINUATION frames per header block (CVE-2024-27316)

§h2_max_glitch_count: Option<u32>

Maximum accumulated protocol anomalies before ENHANCE_YOUR_CALM

§h2_initial_connection_window: Option<u32>

H2 connection tuning parameters. Connection-level receive window size in bytes (RFC 9113 §6.9.2). Default: 16777216 (16 MiB). Credit is returned per half window received.

§h2_max_concurrent_streams: Option<u32>

Maximum concurrent H2 streams the proxy accepts (SETTINGS_MAX_CONCURRENT_STREAMS). Default: 100.

§h2_stream_shrink_ratio: Option<u32>

Shrink threshold ratio for recycled stream slots. Vec is shrunk when total_slots > active_streams * ratio. Default: 2.

§h2_max_rst_stream_lifetime: Option<u64>

Floor of the connection-lifetime cap on RST_STREAM frames received (CVE-2023-44487): trips once the count exceeds this value and the resets received after a response started or on a closed stream exceed the streams a backend answered on the connection. Default: 200000.

§h2_max_rst_stream_abusive_lifetime: Option<u64>

Floor of the cap on “abusive” (pre-response-start) RST_STREAM frames received on a frontend H2 connection — the Rapid Reset signature: trips once the count exceeds this value and more than half of the backend-routed streams were reset before their response. Default: 1000.

§h2_max_rst_stream_emitted_lifetime: Option<u64>

Floor of the cap on RST_STREAM frames emitted by the server that the peer provoked (CVE-2025-8671 “MadeYouReset”): trips once the count exceeds this value and more than half of the backend-routed streams were reset before their response. Covers the emission-direction-flipped sibling of Rapid Reset, where an attacker sends legitimate-looking frames (Content-Length mismatch, header parse error, rejected priority, zero-increment WINDOW_UPDATE on an open stream) that coerce the server into emitting RST_STREAM. Resets Sōzu decides on its own (idle CANCEL, REFUSED_STREAM, STREAM_CLOSED, backend-failure INTERNAL_ERROR) and NoError resets are not counted. Default: 10000.

§h2_max_header_list_size: Option<u32>

Maximum accumulated HPACK-decoded header list size per request (SETTINGS_MAX_HEADER_LIST_SIZE, RFC 9113 §6.5.2). Default: 65536.

§h2_stream_idle_timeout_seconds: Option<u32>

Per-stream idle timeout, in seconds. An open H2 stream that receives no meaningful application data (non-empty DATA or HEADERS frames) for this duration is cancelled (RST_STREAM / CANCEL). Active uploads that trickle DATA frames reset the timer on each non-empty frame. Defends against slow-multiplex Slowloris where a client keeps connection-level activity high (any frame resets the connection idle timer) while pinning up to h2_max_concurrent_streams streams. Unset, it inherits back_timeout, floored at 30 (so 30 with the default back_timeout); an explicit value wins, 0 meaning 1.

§h2_max_header_table_size: Option<u32>

Maximum HPACK dynamic table size (SETTINGS_HEADER_TABLE_SIZE) accepted from the peer. Caps the peer-advertised value to prevent unbounded HPACK encoder memory growth. Default: 65536.

§h2_graceful_shutdown_deadline_seconds: Option<u32>

Maximum wall-clock seconds to wait for in-flight H2 streams after GOAWAY(NO_ERROR) before forcibly closing the connection. Default: 5. Set to 0 to require streams to finish (no forced close).

§h2_max_window_update_stream0_per_window: Option<u32>

Maximum unsolicited connection-level (stream 0) WINDOW_UPDATE frames per second window. Each DATA frame the proxy sends entitles the peer to two that are not counted; only the excess counts. Caps non-zero stream-0 WINDOW_UPDATE floods that would otherwise stay under the generic glitch counter (zero-increment stream-0 updates already trigger GOAWAY per RFC 9113 §6.9). Default: 2000.

§sozu_id_header: Option<String>

Name of the correlation header Sozu injects into every request and response to carry the per-request ULID. Default: “Sozu-Id”. Operators who want to rebrand can set e.g. “X-Edge-Id” or “X-Request-Trace”.

§answers: BTreeMap<String, String>

Per-status HTTP answer template bodies, keyed by HTTP status code (e.g. “404”, “503”). Replaces the per-field shape of CustomHttpAnswers (field 12). The new field is populated alongside http_answers so legacy state files round-trip; new code should read this map.

§elide_x_real_ip: Option<bool>

When true, any client-supplied X-Real-IP header is stripped from requests before forwarding (anti-spoofing). Independently combinable with send_x_real_ip. Default: false.

§send_x_real_ip: Option<bool>

When true, a proxy-generated X-Real-IP header carrying the connection peer IP (post-PROXY-v2 unwrap, i.e. the original client IP) is appended to every forwarded request. Independently combinable with elide_x_real_ip. Default: false.

§h2_max_header_fields: Option<u32>

Maximum number of materialized header fields per request — HPACK fields plus expanded cookie crumbs (RFC 9113 §8.2.3). Bounds the HPACK indexed-reference header bomb, where 1-byte indexed references are amplified into per-entry bookkeeping. Default: 128.

§interface: Option<String>

Name of the network interface (e.g. “wg0”) the listening socket is bound to with SO_BINDTODEVICE, set before bind(). Linux only: the configuration loader refuses the key on any other platform. Part of the listener identity together with address, so two listeners may share an address on different interfaces. Absent = not bound to an interface (the historical behaviour). Not patchable: changing it needs a rebind, so it is absent from the Update*ListenerConfig patches.

§forwarded_headers: Option<i32>

Which forwarding header family is added to every forwarded request: X-Forwarded-*, RFC 7239 Forwarded, both, or none. Independent of elide_x_real_ip and send_x_real_ip. Default: both.

§h2_stream_refusal_percent: Option<u32>

Share, in percent, of the pre-response RST_STREAM cap’s floor (h2_max_rst_stream_abusive_lifetime) at which an H2 connection refuses new client streams with RST_STREAM(REFUSED_STREAM), retryable per RFC 9113 §8.7, and keeps serving its open streams. The cap itself still ends the connection with GOAWAY(ENHANCE_YOUR_CALM). 0 disables the soft state; 100 or more never engages it before the cap. Default: 50.

§h2c_prior_knowledge: Option<bool>

When true, a connection whose first 24 bytes are the HTTP/2 connection preface (PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n, RFC 9113 §3.3 “prior knowledge”) is served as HTTP/2 over cleartext (h2c), exactly as an HTTPS connection that negotiated h2 through ALPN; every other connection stays HTTP/1.x. The Upgrade: h2c mechanism is never supported. When false, a preface is rejected as a malformed HTTP/1.x request (400). Default: false.

Implementations§

Source§

impl HttpListenerConfig

Source

pub fn listener_key(&self) -> ListenerKey

The identity of the listener this message configures or targets.

Source§

impl HttpListenerConfig

Source

pub fn h2_max_rst_stream_per_window(&self) -> u32

Returns the value of h2_max_rst_stream_per_window, or the default value if h2_max_rst_stream_per_window is unset.

Source

pub fn h2_max_ping_per_window(&self) -> u32

Returns the value of h2_max_ping_per_window, or the default value if h2_max_ping_per_window is unset.

Source

pub fn h2_max_settings_per_window(&self) -> u32

Returns the value of h2_max_settings_per_window, or the default value if h2_max_settings_per_window is unset.

Source

pub fn h2_max_empty_data_per_window(&self) -> u32

Returns the value of h2_max_empty_data_per_window, or the default value if h2_max_empty_data_per_window is unset.

Source

pub fn h2_max_continuation_frames(&self) -> u32

Returns the value of h2_max_continuation_frames, or the default value if h2_max_continuation_frames is unset.

Source

pub fn h2_max_glitch_count(&self) -> u32

Returns the value of h2_max_glitch_count, or the default value if h2_max_glitch_count is unset.

Source

pub fn h2_initial_connection_window(&self) -> u32

Returns the value of h2_initial_connection_window, or the default value if h2_initial_connection_window is unset.

Source

pub fn h2_max_concurrent_streams(&self) -> u32

Returns the value of h2_max_concurrent_streams, or the default value if h2_max_concurrent_streams is unset.

Source

pub fn h2_stream_shrink_ratio(&self) -> u32

Returns the value of h2_stream_shrink_ratio, or the default value if h2_stream_shrink_ratio is unset.

Source

pub fn h2_max_rst_stream_lifetime(&self) -> u64

Returns the value of h2_max_rst_stream_lifetime, or the default value if h2_max_rst_stream_lifetime is unset.

Source

pub fn h2_max_rst_stream_abusive_lifetime(&self) -> u64

Returns the value of h2_max_rst_stream_abusive_lifetime, or the default value if h2_max_rst_stream_abusive_lifetime is unset.

Source

pub fn h2_max_header_list_size(&self) -> u32

Returns the value of h2_max_header_list_size, or the default value if h2_max_header_list_size is unset.

Source

pub fn h2_stream_idle_timeout_seconds(&self) -> u32

Returns the value of h2_stream_idle_timeout_seconds, or the default value if h2_stream_idle_timeout_seconds is unset.

Source

pub fn h2_max_header_table_size(&self) -> u32

Returns the value of h2_max_header_table_size, or the default value if h2_max_header_table_size is unset.

Source

pub fn h2_max_rst_stream_emitted_lifetime(&self) -> u64

Returns the value of h2_max_rst_stream_emitted_lifetime, or the default value if h2_max_rst_stream_emitted_lifetime is unset.

Source

pub fn h2_graceful_shutdown_deadline_seconds(&self) -> u32

Returns the value of h2_graceful_shutdown_deadline_seconds, or the default value if h2_graceful_shutdown_deadline_seconds is unset.

Source

pub fn h2_max_window_update_stream0_per_window(&self) -> u32

Returns the value of h2_max_window_update_stream0_per_window, or the default value if h2_max_window_update_stream0_per_window is unset.

Source

pub fn sozu_id_header(&self) -> &str

Returns the value of sozu_id_header, or the default value if sozu_id_header is unset.

Source

pub fn elide_x_real_ip(&self) -> bool

Returns the value of elide_x_real_ip, or the default value if elide_x_real_ip is unset.

Source

pub fn send_x_real_ip(&self) -> bool

Returns the value of send_x_real_ip, or the default value if send_x_real_ip is unset.

Source

pub fn h2_max_header_fields(&self) -> u32

Returns the value of h2_max_header_fields, or the default value if h2_max_header_fields is unset.

Source

pub fn interface(&self) -> &str

Returns the value of interface, or the default value if interface is unset.

Source

pub fn forwarded_headers(&self) -> ForwardedHeaders

Returns the enum value of forwarded_headers, or the default if the field is unset or set to an invalid enum value.

Source

pub fn set_forwarded_headers(&mut self, value: ForwardedHeaders)

Sets forwarded_headers to the provided enum value.

Source

pub fn h2_stream_refusal_percent(&self) -> u32

Returns the value of h2_stream_refusal_percent, or the default value if h2_stream_refusal_percent is unset.

Source

pub fn h2c_prior_knowledge(&self) -> bool

Returns the value of h2c_prior_knowledge, or the default value if h2c_prior_knowledge is unset.

Trait Implementations§

Source§

impl Clone for HttpListenerConfig

Source§

fn clone(&self) -> HttpListenerConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for HttpListenerConfig

Source§

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

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

impl Default for HttpListenerConfig

Source§

fn default() -> HttpListenerConfig

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

impl<'de> Deserialize<'de> for HttpListenerConfig

Source§

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

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

impl Display for HttpListenerConfig

Source§

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

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

impl Eq for HttpListenerConfig

Source§

impl Hash for HttpListenerConfig

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Message for HttpListenerConfig

Source§

fn encoded_len(&self) -> usize

Returns the encoded length of the message without a length delimiter.
Source§

fn clear(&mut self)

Clears the message, resetting all fields to their default.
Source§

fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message to a buffer. Read more
Source§

fn encode_to_vec(&self) -> Vec<u8> ⓘ
where Self: Sized,

Encodes the message to a newly allocated buffer.
Source§

fn encode_length_delimited( &self, buf: &mut impl BufMut, ) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message with a length-delimiter to a buffer. Read more
Source§

fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘ
where Self: Sized,

Encodes the message with a length-delimiter to a newly allocated buffer.
Source§

fn decode(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes an instance of the message from a buffer. Read more
Source§

fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes a length-delimited instance of the message from the buffer.
Source§

fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes an instance of the message from a buffer, and merges it into self. Read more
Source§

fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes a length-delimited instance of the message from buffer, and merges it into self.
Source§

impl Ord for HttpListenerConfig

Source§

fn cmp(&self, other: &HttpListenerConfig) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for HttpListenerConfig

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl PartialOrd for HttpListenerConfig

Source§

fn partial_cmp(&self, other: &HttpListenerConfig) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for HttpListenerConfig

Source§

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

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

impl StructuralPartialEq for HttpListenerConfig

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<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

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

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Reset for T
where T: Default + Clone,

Source§

fn reset(&mut self)

Source§

impl<T> Reset for T
where T: Default + Clone,

Source§

fn reset(&mut self)

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.