Updated on 2024-11-26 GMT+08:00

Smart Compression

When smart compression is enabled, CDN automatically compresses your static files. This saves you a lot of bandwidth by reducing file size and speeds up file transfer. Smart compression includes gzip compression and Brotli compression. The performance of Brotli compression is 15% to 25% higher than that of gzip compression.

Precautions

  • Do not enable this function if MD5 verification has been configured for your origin server. When CDN compresses static files, the MD5 value is changed. As a result, the MD5 value of the compressed file is different from that of the file on the origin server.
  • You cannot enable smart compression for domain names with special configurations.
  • If both gzip and Brotli compression are enabled, Brotli compression is preferentially performed.
  • General image files (such as PNG, JPG, and JPEG) and video files (such as MP4, AVI, and WMV) have already been compressed. Therefore, you do not need to enable smart compression (gzip or Brotli) for these files.

Procedure

  1. Log in to Huawei Cloud console. Choose Service List > Content Delivery & Edge Computing > Content Delivery Network.

    The CDN console is displayed.

  2. In the navigation pane, choose Domains.
  3. In the domain list, click the target domain name or click Configure in the Operation column.
  4. Click the Advanced Settings tab.
  5. Click Edit next to Smart Compression.
    Figure 1 Smart compression
    Table 1 Parameter description

    Parameter

    Description

    Status

    Turn on or off the switch.

    Compression Mode

    Gzip or Brotli compression. If both are selected, Brotli compression is used.

    Format

    Enter file name extensions and multipurpose internet mail extensions (MIME).

    • A single extension contains up to 50 characters and all extensions contain up to 2,000 characters. Separate extensions by semicolon (;).
    • If this parameter is left empty, the default value .js;.html;.css;.xml;.json;.shtml;.htm is used.

    File Size

    Select Enabled and specify a file size range (0 MB to 30 MB). Files in this range will be compressed.

  6. Select a compression method, specify formats of files to compress, and click OK.