pub fn Host<H: AsRef<str>>(host: H) -> HostGuardExpand description
Return predicate that matches if request contains specified Host name.
use ntex::web::{self, guard::Host, App, HttpResponse};
fn main() {
App::default().service(
web::resource("/index.html")
.guard(Host("www.rust-lang.org"))
.to(async || { HttpResponse::MethodNotAllowed() })
);
}