pub struct AllowedHosts { /* private fields */ }Expand description
Reject requests whose Host header is not one of your names
Absolute links, password-reset mails and redirects built from the Host
header are an injection point when anybody can choose it (“host header
poisoning”). AllowedHosts answers 421 Misdirected Request for any other
name, before your handlers see it. Entries are host names without port;
*.example.com matches subdomains (not example.com itself); the port in
the header is ignored. IP-address probes of an orchestrator need
except_paths.
use ullun::secure::AllowedHosts;
let hosts = AllowedHosts::new(["example.com", "*.example.com"]).except_paths(["/livez", "/readyz"]);Implementations§
Source§impl AllowedHosts
impl AllowedHosts
pub fn new<I, S>(hosts: I) -> Self
Sourcepub fn except_paths<I, S>(self, paths: I) -> Self
pub fn except_paths<I, S>(self, paths: I) -> Self
Paths that are served whatever the Host is (health probes addressed by pod IP)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AllowedHosts
impl RefUnwindSafe for AllowedHosts
impl Send for AllowedHosts
impl Sync for AllowedHosts
impl Unpin for AllowedHosts
impl UnsafeUnpin for AllowedHosts
impl UnwindSafe for AllowedHosts
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
Mutably borrows from an owned value. Read more