Brotli

Brotli is a compression algorithm which, much like gzip/deflate, reduces both file size and page load time. Brotli compression is supported starting in LiteSpeed Web Server v5.2 and it is enabled by default for secure static pages and non-ESI dynamic pages.

Beginning with LiteSpeed Web Server version 5.2, brotli, a new compression method, is now supported and enabled by default.

Note: If your browser does not yet support brotli compression, LiteSpeed will automatically default back to gzip. As such, we only recommend disabling brotli if encountering issues.

While useful for reducing the size of static web pages, brotli compression can sometimes cause issues with web pages containing pre-compressed content, such as gzip-compressed PHP. In these cases it may be desirable to disable brotli server wide, which can be accomplished with the following steps.

Instructions

  1. Log in to the LiteSpeed WebAdmin Console

  2. Navigate to Configuration > Server > Tuning

  3. Scroll down to Brotli Compression and click Edit.

  4. Set Enable Brotli Compression to No

  5. Save and perform a Graceful Restart to apply the change.


Brotli compression should now be disabled server wide.

As of LiteSpeed Web Server v5.2.2, Brotli compression can be disabled on a per account/domain basis through Apache configuration and .htaccess files. In previous versions, Brotli could only be disabled server wide.

LiteSpeed Web Server

  1. Log in to the LSWS Web Admin GUI and navigate to Configuration > Virtual Hosts


  2. Select a virtual host and click on the General tab


  3. Scroll down to the Apache Style Configurations setting and click Edit


  4. Add the following to the text box: SetEnv no-brotli


  5. Save and perform a Graceful Restart to apply these changes. The virtual host should no longer be using brotli compression.


cPanel/WHM

The ‘no-brotli’ tag can be enabled selectively through virtual host include files, such as:

  • Without SSL: /etc/apache2/conf.d/userdata/std/2_4/$USER/yourdomain.com/brotli.conf
  • With SSL: /etc/apache2/conf.d/userdata/ssl/2_4/$USER/yourdomain.com/brotli.conf

By adding the following block:

<IfModule LiteSpeed>
    SetEnv no-brotli
</IfModule>

Perform a Graceful Restart to apply these changes. The account should no longer be using brotli compression.

Note: For more information on how to edit virtual host include files please see How To Modify Virtualhost Containers With Include Files in cPanel documentation.

.htaccess

To disable brotli compression via an .htaccess file, simply add:

SetEnv no-brotli

This method allows brotli compression to be disabled for certain sub folders/files without the need for a Graceful Restart.

  • Admin
  • Last modified: 2020/03/31 02:23
  • by Joshua Reynolds