Brotli is an open-source compression algorithm that outperforms intelligent compression. After Brotli compression is enabled, CDN edge nodes compress resources before the resources are returned to clients. Brotli compression reduces file sizes and bandwidth consumption and accelerates file distribution.
Background information
- Compression can be implemented by using Gzip or Brotli. Intelligent compression uses Gzip to compress files. For more information about intelligent compression, see Configure Gzip compression.
- Intelligent compression or Brotli compression compresses files that are larger than 1 KB. Files smaller than 1 KB are not compressed.
- Brotli compression supports the following formats: text/xml, text/plain, text/css, application/javascript, application/x-javascript, application/rss+xml, text/javascript, image/tiff, image/svg+xml, application/json, and application/xml.
- If a response from the origin server includes the
Content-Encoding: br
response header, the resources returned to the client are Brotli-compressed. - If a request includes the
Accept-Encoding: br
request header, the client expects the requested resources to be Brotli-compressed.
Usage notes
- When Alibaba Cloud CDN compresses static files, the MD5 values of the files are changed. If the origin server has MD5 verification enabled, disable intelligent compression.
- If compression is enabled on the origin server and the response includes
content_encoding
, compression on CDN edge nodes does not take effect. - If both Brotli compression and intelligent compression are enabled, and the
Accept-Encoding
request header includes bothbr
andgzip
, only Brotli compression takes effect. - If both HTML optimization and Intelligent or Brotli compression are enabled, HTML optimization does not take effect. Alibaba Cloud CDN only compresses files.
- Brotli is not compatible with all browsers. You can query whether a browser is compatible with Brotli as needed.
- Common types of image files such as PNG, JPG, and JPEG and video files such as MP4, AVI, and WMV are already compressed. Intelligent compression and Brotli compression do not take effect for these files. We recommend that you disable compression. If you want to further reduce the sizes of image files, you can use the image editing feature. If you want to further reduce the sizes of video files, you can use the ApsaraVideo Media Processing (MPS) service to transcode video files. Both image editing and video transcoding reduce image resolution.