aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2024-04-20 04:32:49 +0800
committerGitHub <noreply@github.com>2024-04-19 22:32:49 +0200
commit7eaf7907d7f71e103baced018e6eeb271085789d (patch)
treeceb3ded275e092d3da0828bdc0b7ab12f83a707b
parent199397a852ec2d45524cefcc3c119fce4710560e (diff)
downloadgitea-7eaf7907d7f71e103baced018e6eeb271085789d.tar.gz
gitea-7eaf7907d7f71e103baced018e6eeb271085789d.zip
Fix HEAD method for robots.txt (#30603) (#30605)
Backport #30603 by @wxiaoguang Fix #30601 ``` ~$ curl --head localhost:3000/robots.txt HTTP/1.1 200 OK Accept-Ranges: bytes Cache-Control: max-age=0, private, must-revalidate Content-Length: 5 Content-Type: text/plain; charset=utf-8 Last-Modified: Wed, 19 Jul 2023 04:56:12 GMT X-Gitea-Debug: RUN_MODE=dev Date: Fri, 19 Apr 2024 12:59:44 GMT ``` Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
-rw-r--r--routers/web/web.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/routers/web/web.go b/routers/web/web.go
index 4fff994e42..4aadc5172d 100644
--- a/routers/web/web.go
+++ b/routers/web/web.go
@@ -261,7 +261,7 @@ func Routes() *web.Route {
routes.Get("/metrics", append(mid, Metrics)...)
}
- routes.Get("/robots.txt", append(mid, misc.RobotsTxt)...)
+ routes.Methods("GET,HEAD", "/robots.txt", append(mid, misc.RobotsTxt)...)
routes.Get("/ssh_info", misc.SSHInfo)
routes.Get("/api/healthz", healthcheck.Check)