Lazy gzip - possibly a feature request

Using gzip with compressible static assets makes sense. Less on disk, less in memory, less on the wire.

Does Caddy look for pre-compressed files in the way that Nginx does? I.e. if there are both style.css and style.css.gz on disk, when a request comes in for style.css, the response can vary to use style.css.gz instead. This means the compression only needs to be done once (e.g. just after compiling Less/SASS files), and this happens offline before the server is involved.

3 Likes

Good idea, issue a feature request on github!

1 Like

https://github.com/mholt/caddy/issues/1282 - I will work on that in following days :slight_smile: It will save CPU for me.

Here you go https://github.com/mholt/caddy/pull/1289 :slight_smile:

I’ve added support for both gzip (.gz) and brotli (.br) compressed files.

2 Likes

This is great – I’m amazed @wendigo implemented it so quickly. I asked for this feature in June: Gzip performance; precompressed content

The brotli support will be nice too – brotli compression is very hard on CPU and memory compared to gzip, so having the server do it on the fly is a bad idea.

2 Likes

And it’s merged *\o/*

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.