feat: 添加 robots.txt(屏蔽爬虫索引 API/支付)
This commit is contained in:
@@ -85,6 +85,8 @@ fn create_server_config(
|
|||||||
.service(alipay_notify) // POST /payment/notify(支付宝异步回调)
|
.service(alipay_notify) // POST /payment/notify(支付宝异步回调)
|
||||||
.service(alipay_refund_notify) // POST /payment/refund-notify(支付宝退款回调)
|
.service(alipay_refund_notify) // POST /payment/refund-notify(支付宝退款回调)
|
||||||
.service(payment_login_status) // GET /payment/login-status(网页轮询)
|
.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)))
|
.service(web::resource("/static/{tail:.*}").route(web::get().to(serve_static_files)))
|
||||||
// API 接口
|
// API 接口
|
||||||
|
|||||||
11
static/robots.txt
Normal file
11
static/robots.txt
Normal 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$
|
||||||
Reference in New Issue
Block a user