caddy
caddy copied to clipboard
Add support for `prefer_precompressed` to FileServer
Fixes #5116
Todos:
- [ ] Update docs (eg, https://caddyserver.com/docs/caddyfile/directives/file_server#syntax)
- [ ] Review HTTP headers used when decompressing on-the-fly
- [ ] Tests
- [ ] Both
compressedandprecompressedused in the module, maybe only useprecompressed? - [ ] Need to handle URL canonicalization?
- [ ]
TODO:s in code
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.
@francislavoie @mholt
This is still a spike as I'm trying to understand how we want to approach this before I do things properly.
Currently, I added a couple of if preferPrecompressed before the normal flow: the first one checks directly for the compressed file according to the client's accepted encodings and the second one looks for all the possible compressed files and, if one is found, uncompresses it.
I left the rest of the code because it takes care of the index files and browse. But we may want to consolidate things a bit more.
Would you be willing to share some feedback please?
Thanks for working on this -- I'll try to get around to this after the 2.8 release :)