4 ms·
Speaking of sane defaults, I wonder how many people are aware that Caddy serves dotfiles by default.
by achairapart 5y ago
Speaking of sane defaults, I wonder how many people are aware that Caddy serves dotfiles by default.
- mholt 5y agoThat's incorrect. Caddy does not serve any files by default. You have to explicitly enable file serving in your config.
- achairapart 5y agoSorry Matt, didn't want to be rude. But yes, it does. Using the file_serve directive, dotfiles are served by default. Here are some random domains taken from the Caddy Forum threads: https://lastfree.space/.git/HEAD https://lastfree.space/.git/HEAD https://www.aspecthq.com/.git/HEAD https://www.aspecthq.com/.git/HEAD Those people are unaware of serving their git (or .env files or other secrets) over the internet, probably because are used to other webservers that just block this behaviour by default. And it's ok to not do or be like the others, but this should at least be mentioned in the docs.
- SirGiggles 5y agoWhat you initially stated implies a completely different meaning. You initially made the implication that Caddy would enable the file server implicitly when it does not. That was what I interpreted upon first reading. Your correction states that dotfiles are served using the file_server directive which is correct and and example is given in hiding the .git folder [1] [1] https://caddyserver.com/docs/caddyfile/directives/file_server https://caddyserver.com/docs/caddyfile/directives/file_serve...
- mholt 5y agoWith all due respect, you're wrong. If Caddy is serving any files, the user explicitly enabled that functionality. And when enabled, it only serves files within the root directory specified by the user, or the current working directory, and the docs are very clear about this: https://caddyserver.com/docs/modules/http.handlers.file_server#root https://caddyserver.com/docs/modules/http.handlers.file_serv...
- achairapart 5y agoI stand corrected about the docs, somehow I missed the additional clarifications.