Repository navigation
fileserver: only match a dir when the pattern ends by / - #8352
Merged
francislavoie merged 1 commit intoNov 4, 2026
Merged
Conversation
Since caddyserver#8326, the trailing slash of the expanded request path was kept, so `{path}` started to match directories: with php_fastcgi's `try_files {path} {path}/index.php index.php`, a request for `/dir/` matched the directory instead of `/dir/index.php`, and was no longer sent to PHP. A candidate ending in a slash now matches nothing unless the pattern itself ends in one, as before, while still never matching a regular file.
francislavoie
approved these changes
Nov 4, 2026
francislavoie
pushed a commit
that referenced
this pull request
Nov 5, 2026
(cherry picked from commit b5d67d6)
5 tasks
dunglas
added a commit
to dunglas/caddy
that referenced
this pull request
Nov 7, 2026
The literal candidate built for the final entry of first_exist_fallback cleaned the path without the rules of caddyserver#8326 and caddyserver#8352. With "{path}" as that entry, "/.env/" and "/.env/./" matched the regular file "/.env", bypassing path matchers that see the trailing slash. Both candidate builders now share the same cleaning and splitting.
steadytao
pushed a commit
to dunglas/caddy
that referenced
this pull request
Nov 8, 2026
The literal candidate built for the final entry of first_exist_fallback cleaned the path without the rules of caddyserver#8326 and caddyserver#8352. With "{path}" as that entry, "/.env/" and "/.env/./" matched the regular file "/.env", bypassing path matchers that see the trailing slash. Both candidate builders now share the same cleaning and splitting.
steadytao
pushed a commit
that referenced
this pull request
Nov 8, 2026
* fileserver: apply slash rules to fallback entry The literal candidate built for the final entry of first_exist_fallback cleaned the path without the rules of #8326 and #8352. With "{path}" as that entry, "/.env/" and "/.env/./" matched the regular file "/.env", bypassing path matchers that see the trailing slash. Both candidate builders now share the same cleaning and splitting. * fileserver: handle Windows separators in file matcher
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes caddyserver/caddy#8353.
This is because of #8326 (released in v2.11.8). Sorry, this endless.
Details
Assistance Disclosure
Generated by Claude Code (Opus 5.5), reviewed by me.