[][src]Function actix_web::pred::Host

pub fn Host<S: 'static, H: AsRef<str>>(host: H) -> HostPredicate<S>

Return predicate that matches if request contains specified Host name.

use actix_web::{pred, App, HttpResponse};

fn main() {
    App::new().resource("/index.html", |r| {
        r.route()
            .filter(pred::Host("www.rust-lang.org"))
            .f(|_| HttpResponse::MethodNotAllowed())
    });
}