Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HEAD to /robots.txt returns 404 error #30601

Closed
osfrickler opened this issue Apr 19, 2024 · 1 comment · Fixed by #30603
Closed

HEAD to /robots.txt returns 404 error #30601

osfrickler opened this issue Apr 19, 2024 · 1 comment · Fixed by #30603
Labels

Comments

@osfrickler
Copy link

Description

When accessing the /robots.txt location with curl -I, a 404 error is returned. Instead a proper 200 response is expected. Other locations seem not to be affected.

$ curl -I https://try.gitea.io/robots.txt
HTTP/2 404 
alt-svc: h3=":443"; ma=2592000
cache-control: max-age=0, private, must-revalidate, no-transform
content-type: text/plain;charset=utf-8
date: Fri, 19 Apr 2024 12:24:58 GMT
server: Caddy
set-cookie: i_like_gitea=0b00704e9048a57e; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _csrf=6C6usmqRx9Q9v3UExz4aJICNcMU6MTcxMzUyOTQ5ODYwMDU0MTEzNg; Path=/; Max-Age=86400; HttpOnly; Secure; SameSite=Lax
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
content-length: 11

$ curl -s -i https://try.gitea.io/robots.txt | head
HTTP/2 200 
accept-ranges: bytes
alt-svc: h3=":443"; ma=2592000
cache-control: private, max-age=21600
content-type: text/plain; charset=utf-8
date: Fri, 19 Apr 2024 12:25:08 GMT
last-modified: Thu, 16 Sep 2021 04:52:52 GMT
server: Caddy
content-length: 108
...

Gitea Version

1.23.0+dev-172-geb24d973b0

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

using try.gitea.io, same issue on https://opendev.org

Database

MySQL/MariaDB

@wxiaoguang
Copy link
Contributor

-> Fix HEAD method for robots.txt #30603

wxiaoguang added a commit that referenced this issue Apr 19, 2024
GiteaBot pushed a commit to GiteaBot/gitea that referenced this issue Apr 19, 2024
GiteaBot pushed a commit to GiteaBot/gitea that referenced this issue Apr 19, 2024
wxiaoguang pushed a commit that referenced this issue Apr 19, 2024
silverwind pushed a commit that referenced this issue Apr 19, 2024
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants