tower_allowed_hosts 0.3.0

tower allowed hosts layer
Documentation

TOWER ALLOWED HOSTS

Project status & info:

License Crates Version Docs
License: MIT Crate Docs

Tower service which limits request from only hosts

Add as dependencies

Edit Cargo.toml file to add tower_allowed_hosts as dependencies

[dependencies]
tower_allowed_hosts = "0.3.0"

Usage

To use non regex based hosts you can use

let tower_layer = tower_allowed_hosts::AllowedHostLayer::new(&["127.0.0.1".to_string()]);

If you need to use regex based host matching you need to enable regex feature for crate than you can use

let tower_layer = tower_allowed_hosts::AllowedHostLayer::new_regex(&[regex::Regex::new("^127.0.0.1$")?]);