After you enable the intelligent compression feature, Alibaba Cloud Dynamic Route for CDN (DCDN) nodes compress resources before the resources are returned to clients. This 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 DCDN 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 carries content_encoding, compression on DCDN 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 HTML optimization and file or Brotli compression are enabled, HTML optimization does not take effect. DCDN only compresses files.
  • Common types of image files such as PNG, JPG, and JPEG and video files such as MP4, AVI, and WMV have already been 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 the sizes of video files, you can use the video transcoding feature.

Procedure

  1. Log on to the DCDN 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 Configure in the Actions column.
  4. In the left-side navigation pane on the details page of the specified domain name, click Optimization.
  5. In the File Compression section, turn on File Compression.

    After intelligent compression is enabled, you can compare the file types before and after intelligent compression is enabled. If the file extension is .gzip, the file is compressed.

    Configure intelligent compression

Related API operations

BatchSetDcdnDomainConfigs