Brotli is a modern compression algorithm developed by Google, designed to compress web content more efficiently. Introduced in 2015, Brotli is now supported by all major browsers and is widely adopted across modern web infrastructure.
Compression plays a critical role in web performance by reducing file sizes before they are transmitted to users. Smaller files mean faster downloads, lower bandwidth usage, and improved page load times. Brotli is particularly effective at compressing static assets such as CSS, JavaScript, fonts, and images, where its higher compression ratio can provide significant savings.
Brotli supports both static compression (where files are pre-compressed at build time) and dynamic compression (where files are compressed on-the-fly by the server). Static compression is recommended for production environments, while dynamic compression is used when static files are not pre-compressed.
In xCloud environments, Brotli is automatically enabled on NGINX servers, ensuring all eligible files benefit from this advanced compression algorithm without requiring manual intervention. However, if you’re using Cloudflare, you can use Brotli compression on both NGINX and OpenLiteSpeed (OLS) servers. This provides flexibility for Cloudflare users to take advantage of Brotli’s benefits, regardless of the server platform.
Note: Brotli is automatically installed on the new servers. However, it is not installed on the old servers for now.
Configuring Brotli For Your Site #
If you want to access Brotli, you’ll need to make sure your site is using HTTPS (SSL). Brotli only works with secure connections, so be sure to get your SSL certificate set up first. Once enabled, these are the default settings for Brotli you will get :
brotli on; brotli_static on; brotli_comp_level 4; brotli_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/vnd.geo+json application/vnd.ms-fontobject application/x-font-opentype application/x-font-truetype application/x-font-ttf application/x-javascript application/x-web-app-manifest+json application/xhtml+xml application/xml application/xml+rss image/bmp font/eot font/opentype font/otf image/svg+xml image/vnd.microsoft.icon image/x-win-bitmap image/x-icon text/cache-manifest text/css text/javascript text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy text/xml; |
Verifying if Brotli is Working on Your Website #
To ensure Brotli is working on your site, you can use various online tools to test your website’s compression. One of the simplest ways to verify is by using the Gift of Speed Gzip test tool, which also checks Brotli compression.
Here’s how you can verify if Brotli is enabled:
- Go to Gift of Speed Gzip Test.
- Enter your website URL and click “Test Your Site.”
- Once the test is complete, look at the Content-Encoding header in the response.

If Brotli is working correctly, you should see br listed as the encoding method. For example: Content-Encoding: br
If you see gzip or deflate, it means Brotli is not enabled or being used. If br is present, you know that Brotli is successfully compressing your assets.
Verifying Brotli Using Command Line #
Alternatively, you can verify if Brotli is working using the command line with curl. Here are some commands to help you check for Brotli or Gzip compression:
- Check for Gzip Compression
Run the following command to see if Gzip is enabled:
curl -s -I -H "Accept-Encoding: gzip" https://example.com | grep -i "content-encoding"
If Gzip is enabled, you will see:
Content-Encoding: gzip
- Check for Brotli Compression
Run the following command to see if Brotli is enabled:
curl -s -I -H "Accept-Encoding: br" https://example.com | grep -i "content-encoding"
If Brotli is enabled, you will see:
- Content-Encoding: br
- Check for Both (Gzip and Brotli) at Once
If you want to check for both compression types, run:
curl -s -I -H "Accept-Encoding: gzip, br" https://example.com | grep -i "content-encoding"
If both are supported, the response might be:
Content-Encoding: br
or
Content-Encoding: gzip
The server typically chooses the best compression method, and Brotli is preferred if both are available.
- Check for Compression with Full Request
If you want to view the full response headers, use this command:
curl -s -H "Accept-Encoding: gzip, br" -D - https://example.com -o /dev/null
Brotli compression is a powerful tool to enhance your performance by reducing file sizes and improving page speed. With automatic configuration and smart optimization with xCloud, your applications benefit from Brotli’s efficiency without requiring manual setup.
Still stuck? Contact our dedicated support team for any of your queries.