After intelligent compression is enabled, CDN edge nodes compress resources before the resources are returned to clients. Intelligent compression reduces file sizes, accelerates file distribution, and reduces bandwidth consumption.

Background information

  • Both Gzip compression and Brotli compression are supported. Intelligent compression uses Gzip to compress files. For more information about Brotli compression, see Configure Brotli compression.
  • Intelligent compression compresses files that are larger than 1 KB. Files smaller than 1 KB are not compressed.
  • Intelligent 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 request carries the Accept-Encoding: gzip request header, the client expects the requested resources to be Gzip-compressed.
  • If a response from the origin server carries the Content-Encoding: gzip response header, the resources returned to the client are Gzip-compressed.

Usage notes

  • Intelligent compression (Gzip compression) is compatible with all browsers. Brotli compression is not compatible with outdated browsers. You can query whether a browser supports Brotli compression as needed.
  • 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 and Brotli compression.
  • If compression is enabled on the origin server and the response from the origin server carries 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 carries both br and gzip, 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.
  • Image files in common formats, including PNG, JPG, and JPEG, and video files in common formats, including MP4, AVI, and WMV, are already compressed. Intelligent compression and Brotli compression do not take effect for these files. We recommend that you disable intelligent compression and Brotli compression. If you want to further reduce image file sizes, you can use the image editing feature. If you want to further reduce video file sizes, you can use the video transcoding feature.

Procedure

  1. Log on to the Alibaba Cloud CDN console.
  2. In the left-side navigation pane, click Domain Names.
  3. On the Domain Names page, find the domain name that you want to manage and click Manage in the Actions column of the domain name.
  4. In the management pane of the domain name, click Optimization.
  5. In the Intelligent Compression section, turn on Intelligent Compression and set the parameters.

    After intelligent compression is enabled, you can compare the formats of a file before and after intelligent compression is enabled. If the file extension is .gzip, it indicates that the file is compressed.

    Intelligent compression

Related API operations

BatchSetCdnDomainConfig