Skip to content

Commit 7eaf790

Browse files
GiteaBotwxiaoguang
andauthored
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 <[email protected]>
1 parent 199397a commit 7eaf790

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

routers/web/web.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ func Routes() *web.Route {
261261
routes.Get("/metrics", append(mid, Metrics)...)
262262
}
263263

264-
routes.Get("/robots.txt", append(mid, misc.RobotsTxt)...)
264+
routes.Methods("GET,HEAD", "/robots.txt", append(mid, misc.RobotsTxt)...)
265265
routes.Get("/ssh_info", misc.SSHInfo)
266266
routes.Get("/api/healthz", healthcheck.Check)
267267

0 commit comments

Comments
 (0)