caddy icon indicating copy to clipboard operation
caddy copied to clipboard

Add support for `prefer_precompressed` to FileServer

Open 3v0k4 opened this issue 1 year ago • 3 comments
trafficstars

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 compressed and precompressed used in the module, maybe only use precompressed?
  • [ ] Need to handle URL canonicalization?
  • [ ] TODO:s in code

3v0k4 avatar Apr 30 '24 09:04 3v0k4

CLA assistant check
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.

CLAassistant avatar Apr 30 '24 09:04 CLAassistant

@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?

3v0k4 avatar Apr 30 '24 09:04 3v0k4

Thanks for working on this -- I'll try to get around to this after the 2.8 release :)

mholt avatar May 06 '24 22:05 mholt