diff --git a/src/main.rs b/src/main.rs index 9c2cd9a..65e446b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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 接口 diff --git a/static/robots.txt b/static/robots.txt new file mode 100644 index 0000000..516e62c --- /dev/null +++ b/static/robots.txt @@ -0,0 +1,11 @@ +User-agent: * +Disallow: /payment +Disallow: /api +Disallow: /weather +Disallow: /static + +# Allow root (status page) +Allow: /$ + +# Allow health check +Allow: /health$