请选择
Edge Acceleration
  • Site Acceleration
    • Overview
    • Quickly Import and Export Site Configuration
    • Access Control
      • Token Authentication
    • Smart Acceleration
    • File Optimization
      • Smart Compression
    • Network Optimization
      • HTTP/2
      • HTTP/3(QUIC)
        • Overview
        • Enable HTTP/3
        • QUIC SDK
          • SDK Overview
          • SDK Download and Integration
          • Sample Code
            • Android
            • iOS
          • API Documentation
            • Android
            • iOS
      • IPv6 Access
      • Maximum Upload Size
      • WebSocket
      • Client IP Geolocation Header
      • Client IP Geographical Location
      • gRPC
    • URL Rewrite
      • Access URL Redirection
      • Origin-Pull URL Rewrite
    • Modifying Header
      • Modifying HTTP Response Headers
      • Modifying HTTP Request Headers
    • Custom Error Page
    • Request and Response Actions
      • Processing order
      • Default HTTP Headers of Origin-Pull Requests
      • Default HTTP Response Headers
    • Media Services
      • Audio and Video Pre-pulling
      • Just-in-Time Image Processing
      • Just-in-Time Media Processing
      • VOD Media Origin
  • L4 Proxy
    • Overview
    • Creating an L4 Proxy Instance
    • Modifying an L4 Proxy Instance
    • Disabling or Deleting an L4 Proxy Instance
    • Batch Configuring Forwarding Rules
    • Obtaining Real Client IPs
      • Obtaining Real TCP Client IPs via TOA
      • Obtaining Real Client IPs Through Protocol V1/V2
        • Overview
        • Method 1: Obtaining Real Client IPs Through Nginx
        • Method 2: Parsing Real Client IPs on Application Server
        • Format of Real Client IPs Obtained Through Proxy Protocol V1/V2
      • Transmitting Client Real IP via SPP Protocol
  • Edge DNS
    • Hosting DNS Records
      • Modifying DNS Servers
      • Configuring DNS Records
      • Advanced DNS Configuration
    • Domain Connection
      • Adding A Domain Name for Acceleration
      • Ownership Verification
      • Modifying CNAME Records
    • Domain alias
      • Overview
      • Configuration Guide
      • Batch Connecting SaaS Domain Names
      • Configuring Alias Domain Names for Disaster Recovery
    • Traffic Scheduling
      • Traffic Scheduling Management
    • Origin Configuration
      • Origin-pull configuration
        • Configuring Origin-Pull HTTPS
        • Host Header Rewrite
        • Controlling Origin-pull Requests
        • Redirect Following During Origin-Pull
        • HTTP/2 Origin-Pull
        • Range GETs
      • Load Balancing
        • Overview
        • Quickly Create Load Balancers
        • Health Check Policies
        • Viewing the Health Status of Origin Server
        • Related References
          • Load Balancing-Related Concepts
          • Introduction to Request Retry Strategy
      • Origin Group Configuration
      • Related References
        • ld Version Origin Group Compatible Related Issues
      • Collect EdgeOne origin-pull node IP
  • Edge Cache
    • Overview
    • EdgeOne Cache Rules
      • Content Cache Rules
      • Cache Key Introduction
      • Vary Feature
    • Cache Configuration
      • Custom Cache Key
      • Node Cache TTL
      • Status Code Cache TTL
      • Browser Cache TTL
      • Offline Caching
      • Cache Prefresh
    • Clear and Preheat Cach
      • Cache Purge
      • URL Pre-Warming
    • How to improve the Cache Hit Rate of EdgeOne
  • Rules Engine
    • Overview
    • Supported Matching Types and Actions
    • Rule Management
    • variables

Smart Compression

Function Introduction

EdgeOne enables Gzip or Brotli compression globally by default. When the client request header carries Accept-Encoding: br, gzip or Accept-Encoding: br or Accept-Encoding: gzip, the node will intelligently compress files based on their Content-Type. Compressed files can effectively reduce the size of resources and speed up content transmission. Enabling smart compression can help you:
1. Improve user experience: By reducing resource size, web page loading speed can be significantly improved, providing a better user experience. Especially for websites with a large amount of CSS, JavaScript, and other resources, enabling compression can greatly reduce loading time.
2. Save traffic: Compressed resources will consume less network traffic, which will help reduce operational costs.

Directions

Note:
By default, you do not need to modify this configuration. If in some scenarios, such as: the current client will perform MD5 verification on the file or the current client does not support parsing the specified compressed file, and you want the current site to use only Brotli compression or Gzip compression, or not to compress at all, you can follow the steps below.

Scenario 1: Enable/Disable Smart Compression for All Domain Names of the Site

If you need to enable/disable smart compression for the whole connected site, please refer to the following steps:
1. Log in to the EdgeOne console and click Site List in the left sidebar. In the site list, click the target site.
2. On the site details page, click Site Acceleration to enter the global site configuration page. Then click File Optimization in the right sidebar.
3. Find the smart compression configuration card, which is enabled by default. Click the switch to configure enable/disable.


Scenario 2: Enable/Disable Smart Compression for Specific Domain Names

If you only need to enable/disable smart compression for specific domain names, please refer to the following steps:
1. Log in to the EdgeOne console and click Site List in the left sidebar. In the site list, click the target site.
2. On the site details page, click Site Acceleration to enter the global site configuration page. Then click the Rule Engine tab.
3. On the rule engine management page, click Create rule and select Add blank rule.
4. On the rule editing page, select the Host matching type to match requests for specific domain names.
5. Click Operation > Select Box, and in the pop-up operation list, select the operation as Smart Compression, and click the switch to enable/disable Gzip or Brotli compression.

6. Click Save and Publish to complete the rule configuration.

Related References

Smart Compression Effective Rules

1. Smart compression supports file size range:256B - 30MB。
2. Smart compression is synchronous compression, compressing files while fetching them from the origin. When the node first requests a compressed file, it can directly respond with the compressed file.
3. Smart compression compresses files based on Content-Type by default, supporting the following types:
text/html
text/xml
text/plain
text/css
text/javascript
application/json
application/javascript
application/x-javascript
application/rss+xml
application/xmltext
image/svg+xml
image/tiff
text/richtext
text/x-script
text/x-component
text/x-java-source
text/x-markdown
text/js
image/x-icon
image/vnd.microsoft.icon
application/x-perl
application/x-httpd-cgi
application/xml
application/xml+rss
application/vnd.api+json
application/x-protobuf
multipart/bag
multipart/mixed
application/xhtml+xml
font/ttf
font/otf
font/x-woff
application/vnd.ms-fontobject
application/ttf
application/x-ttf
application/otf
application/x-otf
application/truetype
application/opentype
application/x-opentype
application/font-woff
application/eot
application/font
application/font-sfnt
application/wasm
application/javascript-binast
application/manifest+json
application/ld+json
4. If you have both Gzip and Brotli compression enabled at the same time, and the client request header Accept-Encoding carries both br and gzip:
If the node already has cached content, it will respond according to the following rules:
If the node has both Brotli and gzip compressed cache content, it will prioritize responding with Brotli compression.
If the node only has Brotli compressed cache content, it will prioritize responding with Brotli compression.
If the node only has gzip compressed cache content, it will prioritize responding with Gzip compression.
If the node does not have cached content, it will prioritize responding with Brotli compression.
5. When only Brotli compression is enabled, if the request compression header is gzip, the compression will not take effect, and the original resources will be returned; when only Gzip compression is enabled, if the request compression header is br, the compression will not take effect, and the original resources will be returned.
6. If the origin server has enabled compression and the server carries response headers: Content-Encoding, the smart compression function will no longer be effective.

Request Example

Not Enabled Smart Compression First request for gzip compressed file, not hit node cache, fetch the original file from the origin and cache it to the node, EdgeOne responds with the original file:

Enabled Smart Compression
First request for gzip compressed file, not hit node cache, fetch the file from the origin, node synchronously compresses and caches the compressed file, EdgeOne responds with the compressed file:
Smart compression supports streaming compression, and if the request does not hit the node cache, it will respond in a chunked manner after fetching the file from the origin.

Subsequent requests, hit the node cache of gzip compressed file, the node directly responds with the compressed file.