LZ4 between upstream and Caddy

My setup is like this:

upstream backend → Caddy (doing reverse proxy) → Users

Now, between Caddy and users, the responses can be uncompressed / gzipped in case users ask for it. But, between Caddy and upstream, I want to have LZ4 compression. Upstream can return LZ4 responses all the time. Caddy would have to decompress it and handle it as it would a normal request before sending to the user.

What’s the best way to achieve this functionality? Is that baked in? Or, would it require a plugin?

As far as I know, no HTTP servers or browsers supports LZ4 compression for HTTP. I can’t find any information about any that do, anyway. I don’t see a known value for Content-Encoding for LZ4. See Content-Encoding - HTTP | MDN for example.

Yeah, LZ4 isn’t as popular as it should be. But, if I were to do LZ4 between upstream and Caddy, what’s the best way? Would a plugin be the right way to do this?

It’s not viable, because it’s non-standard.

But Caddy’s encoder is pluggable. See this plugin for example which adds brotli compression (which also isn’t viable to include in Caddy because it doesn’t perform well enough):

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.