Gitea instance returns HTTP status 404 when only asking for headers #364

Closed
opened 2025-11-02 03:20:20 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @dakira on GitHub (Feb 18, 2017).

  • Gitea version (or commit ref): 1.0.1 (all Gitea and Gogs versions are affected)
  • Git version: 1.9.1
  • Operating system: Ubuntu 14.04 through 16.10
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (see below)
    • No
    • Not relevant

Description

When requesting headers only, from a Gitea-server, it wrongly returns HTTP status 404.

Expected: HTTP 200.

~ curl -I https://try.gitea.io
HTTP/1.1 404 Not Found
Content-Type: text/html; charset=UTF-8
Date: Sat, 18 Feb 2017 12:22:11 GMT
Set-Cookie: lang=en-US; Path=/; Max-Age=2147483647
Set-Cookie: i_like_gitea=003f17e962323116; Path=/; HttpOnly
Set-Cookie: _csrf=-GQNJ7f6zhbIHnvi9zdMfG1sha86MTQ4NzQyMDUzMDk5NjQ4MTc4OA%3D%3D; Path=/; Expires=Sun, 19 Feb 2017 12:22:10 GMT; HttpOnly
X-Frame-Options: SAMEORIGIN

This is not expected behavior for a site that is available. Uptime-Monitors will show gitea instances as down because they usually only request the headers.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Originally created by @dakira on GitHub (Feb 18, 2017). - Gitea version (or commit ref): 1.0.1 (all Gitea and Gogs versions are affected) - Git version: 1.9.1 - Operating system: Ubuntu 14.04 through 16.10 - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [x] Yes (see below) - [ ] No - [ ] Not relevant ## Description When requesting headers only, from a Gitea-server, it wrongly returns HTTP status 404. Expected: HTTP 200. ``` ~ curl -I https://try.gitea.io HTTP/1.1 404 Not Found Content-Type: text/html; charset=UTF-8 Date: Sat, 18 Feb 2017 12:22:11 GMT Set-Cookie: lang=en-US; Path=/; Max-Age=2147483647 Set-Cookie: i_like_gitea=003f17e962323116; Path=/; HttpOnly Set-Cookie: _csrf=-GQNJ7f6zhbIHnvi9zdMfG1sha86MTQ4NzQyMDUzMDk5NjQ4MTc4OA%3D%3D; Path=/; Expires=Sun, 19 Feb 2017 12:22:10 GMT; HttpOnly X-Frame-Options: SAMEORIGIN ``` This is not expected behavior for a site that is available. Uptime-Monitors will show gitea instances as down because they usually only request the headers. <bountysource-plugin> --- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/42176476-gitea-instance-returns-http-status-404-when-only-asking-for-headers?utm_campaign=plugin&utm_content=tracker%2F47456670&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F47456670&utm_medium=issues&utm_source=github). </bountysource-plugin>
GiteaMirror added the type/enhancement label 2025-11-02 03:20:20 -06:00
Author
Owner

@Fastidious commented on GitHub (Feb 19, 2017):

I think http://try.gitea.io is having problems. That might be the reason of this.

@Fastidious commented on GitHub (Feb 19, 2017): I think http://try.gitea.io is having problems. That might be the reason of this.
Author
Owner

@dakira commented on GitHub (Feb 20, 2017):

For reference, this was already discussed for Gogs: https://github.com/gogits/gogs/issues/2857

@dakira commented on GitHub (Feb 20, 2017): For reference, this was already discussed for Gogs: https://github.com/gogits/gogs/issues/2857
Author
Owner

@dakira commented on GitHub (Feb 20, 2017):

This route should help health checks pass for Gitea.

m.Head("/", func() {
    return "Operating"
})
@dakira commented on GitHub (Feb 20, 2017): This route should help health checks pass for Gitea. ``` m.Head("/", func() { return "Operating" }) ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#364