I have a big collection of quite compressible files, which aren’t changed that often. Therefore it would be nice to just save them compressed and have caddy serve them as either compressed or uncompressed (if the client really doesn’t support compressed respones). Currently, when running a caddy fileserver with the precompressed option, caddy only delivers the compressed variants of a file if the uncompressed file also exists…
We implemented it this way because we only look for a precompressed file after finding that the main file exists, to avoid doing multiple filesystem calls when requesting files that don’t exist (which would hurt performance when under heavy load). Also, the Accept-Encoding header is optional, so it would be awkward to only be able to serve the file if the header is specified.
I realize that’s not what you want to hear, but it’s a compromise. Most of the time, both need to exist for things to work properly. There might be a way we can add an option to not check for the primary file though, so like Matt said, open an issue on Github
Yeah, I think since it’s the client’s option to accept encoding, for compatibility sake it makes sense by default to serve a compressed version of an existing file in case the encoded version isn’t accepted, right? So the current behavior seems right to me, but I imagine an option to change that to accommodate this use case on the user’s option also makes sense.
All discussable on the Github once an issue is open.