pub fn validate_header_predicate(
predicate: &HeaderPredicate,
) -> Result<(), &'static str>Expand description
Validate one frontend header predicate (sozu-proxy/sozu#1253).
The name must be an RFC 9110 token, and neither Host nor Cookie:
like an affinity_header (validate_affinity_key), a predicate on
either could never find its header among the request’s — H1 folds Host
into the request authority (H2 sends :authority) and both parsers move
cookies into a jar — so it would silently never match. exact and regex
need a value, present refuses one, and an exact value carrying a
control byte no parsed header value can hold is refused rather than left
to never match. A regex value’s grammar is the router’s to check, where
it is compiled.
Called at config load and by the worker’s router on every frontend
addition, which the main process also runs before accepting one
(validate_frontend_request in bin/src/command/requests.rs), so a TOML
load, a saved state and a direct API request are held to the same rule.