Caddy: Serving .gz when .br is smaller and both are available

Created on 24 Dec 2016  路  3Comments  路  Source: caddyserver/caddy

(Are you asking for help with using Caddy? Please use our forum instead: https://forum.caddyserver.com. If you are filing a bug report, please answer the following questions. If your issue is not a bug report, you do not need to use this template. Either way, please consider donating if we've helped you. Thanks!)

1. What version of Caddy are you running (caddy -version)?

0.9.4

2. What are you trying to do?

I'm trying to serve .br versions of my files, when both .gz and .br files are present.

3. What is your entire Caddyfile?

(Put Caddyfile here)

Not applicable (I don't think)

4. How did you run Caddy (give the full command and describe the execution environment)?

Using https://github.com/ZZROTDesign/alpine-caddy

5. What did you expect to see?

In the response headers of my website I expected to see content-encoding: br and a file size of 63 Kilobytes

6. What did you see instead (give full error messages and/or log)?

I see content-encoding: gzip and a file size of 78 Kilobytes.

Not sure if the new .br and .gz functionality prefers .br over .gz if the filesize is smaller - it seems as if it is defaulting to gz all the time. If someone could point me in the direction, I could definitely try to tackle this soon.

Most helpful comment

My mistake - Just realized that I didn't properly update my docker image that was running my website while all others were updated. Sorry about that! Appreciate the help!

All 3 comments

Brotli encoding is always prefered over gzip. If .gz and .br files exist - br should be delivered to the client (if Accept-Encoding: br is present in the headers) - file sizes does not matter at all.

Please attach full communication between client and Caddy - request and response headers + listing of relevant files in the root fs

My mistake - Just realized that I didn't properly update my docker image that was running my website while all others were updated. Sorry about that! Appreciate the help!

Thx @Skilgarriff :)

Was this page helpful?
0 / 5 - 0 ratings