caddy/modules
Kévin Dunglas 5bd0b9355d
fileserver: reject regular files addressed with a trailing separator (#8379)
* fileserver: don't serve regular file when path ends by slash

With canonical URIs disabled, file_server trimmed the trailing slash before
stat and served the file, while path matchers see "/secret.env/" and skip
rules such as "path *.env". Return 404 (or pass through) instead.

* fileserver: trim trailing OS separator before stat

On Windows, SanitizedPathJoin appends a backslash for a path ending in "/",
which the "/" trim left in place. Stat then failed on a regular file, so
"/file/" returned 400 instead of the canonical redirect or a 404.

* fileserver: keep trailing separator of a filesystem root

Trimming it turned a root of `C:\` into `C:`, the current directory of the
drive, and a root of `\` or `/` into an empty path, so requests for "/"
listed or indexed the wrong directory, or failed.

* fileserver: log request path on trailing slash 404

The logged filename has its trailing separator trimmed, so it didn't show the slash that caused the 404.

* fileserver: check trailing slash on matcher path
2026-11-09 07:33:40 +10:00
..
caddyevents events: tell CertMagic which events are worth emitting (#8010) 2026-10-03 01:03:20 +10:00
caddyfs events: Refactor; move Event into core, so core can emit events (#6930) 2025-03-29 08:15:43 -06:00
caddyhttp fileserver: reject regular files addressed with a trailing separator (#8379) 2026-11-09 07:33:40 +10:00
caddypki acmeserver: say when the CA database is locked by another process (#8007) 2026-09-11 14:49:31 +10:00
caddytls caddytls: sync ech publication history to the ech configs (#8376) 2026-11-08 11:18:43 +00:00
filestorage
internal/network reverseproxy: reduce lock contention in dynamic SRV and A upstreams (#7949) 2026-11-03 08:37:50 +00:00
logging logging: Parse request URIs in the query filter like the server does (#8255) 2026-10-19 07:43:29 +00:00
metrics metrics: scope metrics to active config, add optional per-host metrics (#6531) 2024-10-02 08:23:26 -06:00
standard