caddyserver / caddy

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
https://caddyserver.com
Apache License 2.0
55.48k stars 3.91k forks source link

regression in 2.8 file_server serving root index file #6358

Closed willnorris closed 1 month ago

willnorris commented 1 month ago

caddy 2.8 seems to be failing to serve a root /index.html page as I would expect.

Reproduction case

Create index.html file: echo Hello > index.html

Create Caddyfile:

{
  debug
}

:8080 {
  file_server
  try_files {path} {path}/ =404
}

On caddy 2.7, http://localhost:8080/ will load the index.html page and serve "Hello". On caddy 2.8, it returns an empty 404 error. If there is a sub directory like http://localhost:8080/sub/ then the index page loads fine. It is only for the root URL.

mohammed90 commented 1 month ago

Do you think it's the same as #6352?

willnorris commented 1 month ago

ah, yes. This definitely seems to be the same. The same commit identified there, 6d97d8d87beb788d19a4084d07ec9157e5705b13, seems to be where the issue lies. I'll close this as a dup of #6352 and see if I can help debug the issue over there.

mholt commented 1 month ago

Thanks so much for debugging this before I even had a chance to sit down to look at it! :smile: