[][src]Function actix_web::guard::Host

pub fn Host<H: AsRef<str>>(host: H) -> HostGuard

Return predicate that matches if request contains specified Host name.

This example is not tested
use actix_web::{guard::Host, App, HttpResponse};

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