How to serve brotli file?

Hi all,

I have a folder with one file: which is a valid HTML file encoded with Brotli.

In the folder I run caddy (version 0.10.3) and I try to view the page by opening my Firefox browser to localhost:2015.

However, it does not work - what am I doing wrong? I thought caddy would server pre-compressed files.

It’s working for me (using the same version of Caddy). The problem is with your browser.

Firefox 54.0 is sending Accept-Encoding: gzip, deflate. Caddy can’t serve the Brotli file in this case because Firefox didn’t ask for it.

On the other hand, Chrome 58.0.3029.110 sends Accept-Encoding: gzip, deflate, sdch, br. Since Chrome indicated that it would accept Brotli-encoded files, Caddy will serve me a Brotli-encoded file.

1 Like


How does it fail, out of curiosity? Error 404?

@astei, what OS are you using?

I’ve tried:

  • Ubuntu 16 Firefox 54
  • Ubuntu 16 Chrome 59.0.3071.104
  • curl localhost:2015

and they all return 404.

By the way, I have the same problem when the file is gzipped (i.e. I have a single file in my folder: index.html.gz that is a valid Gzipped HTML file).

I’m on macOS Sierra.

The reason you’re getting a 404 is that an uncompressed index.html file doesn’t exist. Make sure it exists, then you should be good to go.

Ahh, that makes sense. Thanks.

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