Gzip compression

更新时间:
复制 MD 格式

After you enable Gzip compression, points of presence (PoPs) compress resources before delivering them to users. This reduces file sizes, improves transfer speeds, and lowers bandwidth consumption.

Background information

  • Gzip compression applies to origin server files that are 1 KB to 10 MB in size. Files smaller than 1 KB or larger than 10 MB are not compressed.

  • Gzip compression is supported for the following MIME types: 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.

  • A client indicates that it supports Gzip-encoded content by including the Accept-Encoding: gzip request header.

  • A server indicates that a resource is Gzip-compressed by including the Content-Encoding: gzip response header.

Notes

  • Gzip compression changes the MD5 hash of static files. If your origin server uses MD5 validation, disable this feature.

  • If the origin server already compresses responses and includes the Content-Encoding response header, ApsaraVideo VOD does not apply additional compression.

  • Common image formats such as PNG, JPG, and JPEG, and video formats such as MP4, AVI, and WMV are already compressed, so Gzip compression provides no additional benefit for these files. To further reduce image file sizes, use the Image processing feature. To further reduce video file sizes, use the Transcoding feature.

Procedure

  1. Log on to the ApsaraVideo VOD console.

  2. In the left-side navigation pane, choose Configuration Management > CDN Configuration > Domain Names.

  3. Find the target domain name and click Configure.

  4. In the left-side navigation pane, click Performance Optimization.

  5. In the Gzip Compression section, turn on the Gzip Compression switch.

    After you enable Gzip compression, you can verify that it is working. A successfully compressed resource is delivered with the Content-Encoding: gzip response header.

    Do not enable this feature if your origin server performs MD5 value verification because compression changes the MD5 value of files.

Related API operations

BatchSetVodDomainConfigs