Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I implement Brotli compression in Apache?

I read about Broli compression and thought I might as well look into supporting it.

A recent(ish) article that I read mentioned a .br file - so will it be as easy as putting an index.br file alongside my index.html file? Or will supporting it mean recompiling Apache?

like image 282
Richard Avatar asked Apr 03 '16 14:04

Richard


3 Answers

Here is a quite nice guide how to add support for pre compressed static content to apache with fall-back to gzip

https://lyncd.com/2015/11/brotli-support-apache/

like image 173
Crami Avatar answered Sep 19 '22 19:09

Crami


Support for Brotli was just added as mod_brotli in Apache trunk, making Apache the first web server with Brotli support. Give it some time and you’ll be able to just enable the Brotli output filter as you would gzip and deflate in Apache. If you’re impatient, you can use the third-party brotli_module as suggested by Joe; or cherry pick the new mod_brotli patch from trunk and apply it to your 2.4.x installation.

like image 45
Daniel Avatar answered Sep 16 '22 19:09

Daniel


Update: Use the Apache mod_brotli.

If your Apache is older, my answer from 2016 might be of interest:


2016 answer:

You could use the Apache module brotli_module by kjdev which works well for me.

You might also want to check out the new mod_brotli patch from Apache as suggested by Aeyoun. I haven't tried it myself, though.

like image 27
Joe Avatar answered Sep 19 '22 19:09

Joe