After you enable the Gzip compression feature, Alibaba Cloud CDN points of presence (POPs) use Gzip to compress resources before the resources are returned to clients. The Gzip compression feature reduces file sizes, accelerates file distribution, and reduces bandwidth consumption.
- Alibaba Cloud CDN supports Gzip compression and Brotli compression. This topic describes how to use Gzip to compress files. For information about Brotli compression, see Configure Brotli compression.
- You can enable the Gzip compression feature or the Brotli compression feature to compress files that are larger than 1 KB. You cannot use the preceding features to compress files that are smaller than 1 KB.
- If a request contains the
Accept-Encoding: gziprequest header, the client expects the requested resources to be Gzip-compressed.
- If a response from the origin server contains the
Content-Encoding: gzipresponse header, the resources returned to the client are Gzip-compressed.
- The Gzip compression feature is compatible with all browsers. The Brotli compression feature is not compatible with outdated browsers. You can query whether a browser supports Brotli compression based on your business requirements.
- When Alibaba Cloud CDN compresses static files, the MD5 values of the files are changed. If the origin server has MD5 verification enabled, disable the Gzip compression feature and the Brotli compression feature.
- If compression is enabled on the origin server and the response from the origin server
content_encoding, compression on CDN POPs does not take effect.
- If both the Gzip compression and Brotli compression features are enabled, and the
Accept-Encodingrequest header contains both
gzip, only the Brotli compression feature 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. The Gzip compression and Brotli compression features do not take effect on these files. We recommend that you disable the Gzip compression and Brotli compression features. If you want to reduce the size of image files, you can use the image editing feature. If you want to reduce the size of video files, you can use the video transcoding feature.
- Log on to the Alibaba Cloud CDN console.
- In the left-side navigation pane, click Domain Names.
- On the Domain Names page, find the domain name that you want to manage and click Manage in the Actions column.
- In the left-side navigation pane of the domain name, click Optimization.
- In the Gzip Compression section, turn on Gzip Compression and configure the parameters based on your business requirements.
You can compare the format of a file before and after the Gzip compression feature is enabled. If the file extension is .gzip, the file is compressed.