Skip to main content

Module http_guard

Module http_guard 

Source
Expand description

HTTP access guard: Origin allow-list, optional API key, and the JSON errors they return.

Structs§

ApiKey
SHA-256 of the configured API key; requests are compared digest to digest.
GuardState

Functions§

guard
Rejects a disallowed Origin with 403, then a missing or wrong API key with 401.
origin_allowed
Loopback origins are always allowed; others must equal an entry of allowed after normalisation.
presented_key
The key a request presents: X-API-Key (even if empty) wins, else the Bearer token.