Crates.io | tower-no-ai |
lib.rs | tower-no-ai |
version | 0.1.1 |
source | src |
created_at | 2024-06-30 01:51:18.221522 |
updated_at | 2024-07-04 15:07:17.209961 |
description | A tower Service and Layer to redirect all AI scraping bots |
homepage | |
repository | https://github.com/itsjunetime/tower-no-ai |
max_upload_size | |
id | 1287732 |
size | 7,447 |
tower-no-ai
A very simple crate to extend tower with the ability to redirect all AI-scraper bot User-Agent headers to a user-defined URL.
This can be done with something like the following (with axum):
use tower_no_ai::NoAiLayer;
use axum::routing::{get, Router};
let route = Router::new()
.route("/", get(hello_world))
// route them to a hetzner 10GB speed test file
.layer(NoAiLayer::new("https://fsn1-speed.hetzner.com/10GB.bin"));
As this is built on tower
, it should work perfectly with all tower-based backends.
Contributions, bug reports, and suggestions are welcome.
Dual-Licensed MIT and Apache 2.0