Skip to content

Commit

Permalink
Fix HEAD method for robots.txt (#30603) (#30605)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
GiteaBot and wxiaoguang authored Apr 19, 2024
1 parent 199397a commit 7eaf790
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion routers/web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 7eaf790

Please sign in to comment.