Brotli is not working over non-https

Why brotli is not supported over HTTP connections, and what you can do to get around the problem on local servers.

489 views
d

By. Jacob

Edited: 2023-08-09 01:09

By default, Brotli is not included in the accept-encoding header Google Chrome, Firefox and Safari, for http connections; apparently this is due to issues with web proxies that misbehave when they encounter non deflate/gzip Content-Encoding.

This is causing problems when developers need to test their brotli implementations on local servers, since those will often be running on HTTP rather than HTTPS.

There is a couple of nice solutions to this problem; one is to modify the accept-encoding header using a browser plugin, and another, my favorite, is to test implementations with cURL from a terminal:

curl -H "accept-encoding: br" --HEAD http://example.com/

So, the reason why your Browser does not include br in its accept-encoding over clean HTTP connections is, most likely, not because it does not support Brotli; you can still do your testing with tools such as cURL from a terminal.

Alternatively, you can also install a self-signed certificate on your local server. The problem with this is that the browser will complain that the connection is not secure.

Note. Beamtic's File Handler has support for Brotli, Deflate, and GZIP; when used to stream static files, it will automatically attempt to serve the best available and browser-supported compression.

Link: Class: File Handler

Tell us what you think:

  1. Understanding file permissions in Unix / Linux based systems, and how to make files immutable.
  2. In this article I will explain how to enable a swapfile on small instances, and why it might be useful, even if you do have enough physical memory.
  3. How to determine an optimal value for pm.max_children and related php-fpm settings for your server and web applications.
  4. Tutorial showing how to configure a VirtualBox Guest VM with HOST-only and NAT adapter, while using the WWW folder from the HOST OS.
  5. You may have wondered what the /etc/php/8.0/conf.d/ directory is for in Debian and Ubuntu, and whether it is better to edit the conf.d files than editing php.ini directly; find out in this Tutorial.

More in: Linux servers