INNER CODE UNIT · Rust
is_reserved_domain_for
ovexro/dockpanel · panel/backend/src/routes/mod.rs:183
pub fn is_reserved_domain_for(domain: &str, headers: &HeaderMap) -> bool {
if is_reserved_domain(domain) {
return true;
}
let Some(host) = headers
.get(axum::http::header::HOST)
.and_then(|v| v.to_str().ok())
else {
return false;
};
// Reuse the BASE_URL parser: it strips an optional scheme, a path and a
// port, and lowercases — a bare `demo.example.com:8443` is exactly that
// shape minus the scheme.
match panel_host_from_base_url(host) {
Some(h) => reserved_match(domain, Some(&h), &[]),
None => false,
}
}