feat: 添加 robots.txt(屏蔽爬虫索引 API/支付)

This commit is contained in:
2026-07-20 09:33:36 +08:00
parent 9fc5c2429e
commit 70bb63be8d
2 changed files with 13 additions and 0 deletions

View File

@@ -85,6 +85,8 @@ fn create_server_config(
.service(alipay_notify) // POST /payment/notify支付宝异步回调
.service(alipay_refund_notify) // POST /payment/refund-notify支付宝退款回调
.service(payment_login_status) // GET /payment/login-status网页轮询
// robots.txt无需认证
.route("/robots.txt", web::get().to(|| async { serve_static_files(web::Path::from("robots.txt".to_string())).await }))
// 静态文件(无需认证)
.service(web::resource("/static/{tail:.*}").route(web::get().to(serve_static_files)))
// API 接口

11
static/robots.txt Normal file
View File

@@ -0,0 +1,11 @@
User-agent: *
Disallow: /payment
Disallow: /api
Disallow: /weather
Disallow: /static
# Allow root (status page)
Allow: /$
# Allow health check
Allow: /health$