gitdataai/libs/api/robots.rs
ZhenYi da9e96f6dd feat: add /robots.txt blocking sensitive paths from crawlers
Disallows: /api/, /health, /metrics, /ws/, /avatar/, /blob/,
/media/, /static/, /assets/
2026-04-25 23:49:50 +08:00

21 lines
431 B
Rust

use actix_web::HttpResponse;
/// Serves robots.txt, blocking all sensitive paths from crawlers.
pub async fn robots() -> HttpResponse {
HttpResponse::Ok()
.content_type("text/plain; charset=utf-8")
.body(
r#"User-agent: *
Disallow: /api/
Disallow: /health
Disallow: /metrics
Disallow: /ws/
Disallow: /avatar/
Disallow: /blob/
Disallow: /media/
Disallow: /static/
Disallow: /assets/
"#,
)
}