pub struct Frontend {Show 14 fields
pub cluster_id: Option<ClusterId>,
pub redirect: RedirectPolicy,
pub redirect_scheme: RedirectScheme,
pub redirect_template: Option<String>,
pub capture_cap_host: usize,
pub capture_cap_path: usize,
pub rewrite_host: Option<RewriteParts>,
pub rewrite_path: Option<RewriteParts>,
pub rewrite_port: Option<u16>,
pub headers_request: Rc<[HeaderEdit]>,
pub headers_response: Rc<[HeaderEdit]>,
pub required_auth: bool,
pub tags: Option<Rc<CachedTags>>,
pub inherits_listener_hsts: bool,
}Expand description
What to do with the traffic for a routed frontend.
Built once at frontend registration time. The expensive work (parsing
rewrite templates, resolving headers into HeaderEdits) happens here
so Router::lookup can run cheaply on the hot path.
A clusterless frontend with redirect == FORWARD is coerced to
UNAUTHORIZED in Frontend::new to avoid a forward loop with no
backend; the explicit UNAUTHORIZED policy then renders a 401.
Tags are wrapped in Rc<CachedTags> so the same frontend can be
referenced from multiple routing slots (pre/tree/post) without copying.
Fields§
§cluster_id: Option<ClusterId>§redirect: RedirectPolicy§redirect_scheme: RedirectScheme§redirect_template: Option<String>§capture_cap_host: usizeNumber of host captures the router will collect for this frontend.
Sized from the matching DomainRule; the router skips capture
extraction entirely when this is 0 (no rewrite references $HOST[…]).
capture_cap_path: usizeNumber of path captures the router will collect for this frontend.
Sized from the matching PathRule; the router skips capture
extraction entirely when this is 0 (no rewrite references $PATH[…]).
rewrite_host: Option<RewriteParts>§rewrite_path: Option<RewriteParts>§rewrite_port: Option<u16>§headers_request: Rc<[HeaderEdit]>§headers_response: Rc<[HeaderEdit]>§required_auth: bool§inherits_listener_hsts: booltrue when the materialised HSTS edit (if any) in
Self::headers_response came from the listener-default
HttpsListenerConfig.hsts rather than the per-frontend
RequestHttpFrontend.hsts block. Consulted by
Router::refresh_inheriting_hsts so a
UpdateHttpsListenerConfig.hsts patch reflows the new default
onto inheriting frontends without overwriting explicit
per-frontend HSTS overrides.
Implementations§
Source§impl Frontend
impl Frontend
Sourcepub fn new(
domain_rule: &DomainRule,
path_rule: &PathRule,
front: &HttpFrontend,
redirect: RedirectPolicy,
redirect_scheme: RedirectScheme,
redirect_template: Option<String>,
rewrite_host: Option<String>,
rewrite_path: Option<String>,
rewrite_port: Option<u16>,
headers: &[Header],
required_auth: bool,
hsts_origin: HstsOrigin,
) -> Result<Self, RouterError>
pub fn new( domain_rule: &DomainRule, path_rule: &PathRule, front: &HttpFrontend, redirect: RedirectPolicy, redirect_scheme: RedirectScheme, redirect_template: Option<String>, rewrite_host: Option<String>, rewrite_path: Option<String>, rewrite_port: Option<u16>, headers: &[Header], required_auth: bool, hsts_origin: HstsOrigin, ) -> Result<Self, RouterError>
Build a Frontend from a domain/path rule pair and an
HttpFrontend configuration.
The richer proto-level fields (redirect, redirect_scheme,
redirect_template, rewrite_*, headers, required_auth) are
not yet carried on HttpFrontend; until they are, this constructor
takes them as explicit arguments so the data flow is testable
today and the call sites in add_http_front only need a one-line
update once the fields are plumbed through.
Coercions:
redirect == UNAUTHORIZEDzeroes out rewrite/headers/auth — the request will be rejected with a 401 regardless.redirect == FORWARDon a clusterless frontend (cluster_id == None) is coerced toUNAUTHORIZED(logged as a warning) to avoid a forward loop with no backend.
Returns RouterError::InvalidHostRewrite /
RouterError::InvalidPathRewrite when a rewrite template fails to
parse against the rule’s capture caps.
Trait Implementations§
impl Eq for Frontend
Source§impl Ord for Frontend
impl Ord for Frontend
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Auto Trait Implementations§
impl !Send for Frontend
impl !Sync for Frontend
impl Freeze for Frontend
impl RefUnwindSafe for Frontend
impl Unpin for Frontend
impl UnsafeUnpin for Frontend
impl UnwindSafe for Frontend
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.