#ai #tower-service #tower #axum #tower-layer

tower-no-ai

A tower Service and Layer to redirect all AI scraping bots

3 unstable releases

new 0.2.0 Dec 1, 2024
0.1.1 Jul 4, 2024
0.1.0 Jun 30, 2024

#879 in HTTP server

Download history 17/week @ 2024-09-14 11/week @ 2024-09-21 12/week @ 2024-09-28 155/week @ 2024-11-30

156 downloads per month

MIT/Apache

9KB
168 lines

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

Dependencies

~660KB
~11K SLoC