Conversation
caddy/caddy.go
Outdated
| if len(tryFiles) == 0 { | ||
| tryFiles = []string{"{http.request.uri.path}", "{http.request.uri.path}/" + indexFile, indexFile} | ||
| if disableFsrv { | ||
| tryFiles = []string{"{http.request.uri.path}/" + indexFile, indexFile} |
There was a problem hiding this comment.
This change beaks the tests.
There was a problem hiding this comment.
Actually, the new behavior is better and more correct than the previous one. I updated the test accordingly.
|
I wonder if it would also make sense to cache the location of existing index files (unless that's something you're already doing here). The only disadvantage would be that when the index file is deleted, we'd get a PHP 500 instead of a 404. |
|
I think it's a good idea. We'll have to introduce a LRU cache in Caddy to do that. It may also be needed for another optimization I have in mind: caching if files (assets) exist or not for some time (configurable). That being said, I'm currently optimizing for the framework case (Laravel/Symfony), and I think that for this specific (but very common) case I'll be able to get 0 to disk access with caddyserver/caddy#6699 and some extra tricks to come. |
Prevents some I/O accesses when disabling the file server and when disabling index files in subdirectory support.