Brotli Compression Algorithm Enabled on All Servers

August 8, 2016

For apps using HTTPS, page loads are now even faster. On all servers managed by ServerPilot, we've enabled the new Brotli compression algorithm developed by Google. Brotli is currently supported by Chrome and Firefox for HTTPS requests.

What is Brotli?

Brotli is a new, highly efficient compression algorithm developed specifically for websites. Just like the very common gzip compression algorithm, Brotli decreases the size of text, such as HTML, CSS, and JavaScript, while that data is being sent from a server to your browser. However, Brotli is better at compressing web pages than gzip.

On average, data compressed with Brotli is 20 percent smaller than data compressed with gzip. For example, a 500 KB file that gzip would compress to 100 KB can instead be compressed to 80 KB by Brotli. Brotli achieves this improvement while maintaining the same fast compression and decompression speeds as gzip.

When Will Brotli Be Used?

Chrome and Firefox currently support Brotli. For both of these browsers, Brotli is only used for HTTPS requests, not for plain HTTP requests.

The reason only HTTPS is supported is because many network proxies around the world expect HTTP compression to always be gzip, so using other types of compression can cause websites to break. Since HTTPS requests are encrypted and proxies can't read or modify any of the content, it's safe to make changes to the compression algorithm used without any risk of breakage by buggy proxies.

How to See Brotli in Action

To check whether Brotli is being used, you can use the Network tab of Chrome's developer tools. With the Network tab open, reload the page.

Next, in the Network tab, click on one of the requests for HTML, CSS, or JavaScript. Note that since all image formats are compressed, image files will never show any type of network compression since it would be a waste to try to compress them again.

Finally, look for the content-encoding header under the Response Headers section. If it's compressed with Brotli, it will show the following:

content-encoding: br

If it's not compressed with Brotli, it will instead show the following:

content-encoding: gzip