Brotli for NGINX
Brotli is defined in RFC 7932 and reading the RFC is fun, it is most simply described by brotli.pro:
Brotli is an open-source algorithm from Google used for compression It is an alternative to the famous GZIP compression. Several case studies have shown that Brotli excels in compression speed and file size in comparison to GZIP when using the default. Also, all modern browsers support Brotli by now, though only over HTTPS.
An implementation of Brotli is available for NGINX by Google. As it needs to be compiled from source I have attached my code below to build it for Debian/Ubuntu.
Warning: Before any implementing HTTP compression, be aware that you may be exposing yourself to BREACH-attacks!
Enable by adding following to enforce Brotli compression in NGINX :
Last updated