1. The problem I’m having:
The documentation of the hide option to the file_server directive reads in part
hide is a list of files or folders to hide; if requested, the file server will pretend they do not exist. Accepts placeholders and glob patterns…Specifying a file name or pattern without a path separator will hide all files with a matching name regardless of its location; otherwise, a path prefix match will be attempted, and then a globular match.
(italics: my emphasis)
I cannot find documentation of what glob syntax this directive understands anywhere within https://caddyserver.com/docs/. In fact, as far as I can tell, this is the only occurrence of either of the above italicized terms anywhere in the documentation.
I can think of four common variants off the top of my head, differing widely in both syntax and capabilities (ksh-like, zsh-like, gitignore-like, and CMD.EXE-like) so I don’t have any convenient way of knowing what will and won’t work other than cut-and-try experimentation.
Two concrete examples of what I’d like to be able to do, but cannot tell if it will work:
file_server {
hide `#*#`
}
This is meant to hide Emacs’ “auto-save” files (created periodically while editing a file that has not yet been saved, so that if the session crashes, unsaved edits can be recovered). They really are named with a # at both the beginning and the end of the base filename. Elsewhere in the documentation it is frequently pointed out that * only works at the beginning or the end of a match; one would hope this is not true of a “globular match” but one has no way of knowing.
file_server {
hide `.[!.]` `.?*`
}
This is meant to hide all dot-files and dot-directories, but [!.] is only the syntax for a negated character class in some glob syntaxes (others use [^.] like regexes and yet others don’t support this at all). It’s also unclear from the documentation whether this will match paths with a dot-directory component that isn’t the rightmost e.g. {root}/.git/config (the intention is that it should).
2. Error messages and/or full log output:
n/a, this is a question about the documentation at https://caddyserver.com/docs/.
3. Caddy version:
n/a, this is a question about the documentation at https://caddyserver.com/docs/. There is no version number visible in the URL or in the text of the documentation.
I happen to have v2.11.7 on the server I’m trying to configure; if the glob syntax accepted by hide changed between versions, I am most interested in what 2.11.7 does, but, since the documentation at https://caddyserver.com/docs/ is not versioned, it really ought to explain the full change history of the syntax, whatever it is.
4. How I installed and ran Caddy:
n/a, this is a question about the documentation at https://caddyserver.com/docs/.