If you want your end users to receive content in compressed form, you can configure compression on the origin or use the suggested compression options on the CDN below.
Important to know, if in a browser request to the CDN there are no HTTP headers such as "Accept-Encoding: gzip, deflate, br", content is given to the end users without compression.
Compression on CDN: GZip and Brotli
CDN servers support "GZip Compression" and "Brotli Compression". From origin always requests the uncompressed version of the file.
By default, these options are turned off. To enable it, expand "Advanced settings", find the "Content" section, click the "Add option" button and select one of the compression.
Enable the necessary option and save settings.
GZip is a data compression method. Typically, GZip compression reduces file size by 70% and can be as high as 90%.
File extensions supporting GZip compression:
- application / xml;
- application / xml+rss;
- text / xml;
Image file formats (jpeg, jpg, png), as well as video files, PDF files, and other binary formats, are already compressed. GZip compression in this case, on the contrary, increases the files’ size.
Brotli is a data compression method that has in several times better compression ratio than the GZip method. The minimum file size that can be compressed is 128 bytes.
Compression is performed on the Origin Shielding. If a pre-cache server doesn't active for a resource, compression does not occur even if the option is enabled.
To activate the "Origin Shielding" option, please, contact the Support Team.
In the "Content types" you can set the data types you wish to have compressed. Some extensions are already selected by default:
- application / xml
- application / xml+rss
- text / xml
- application/vnd. ms-fontobject
You can add and delete all the types listed above except "text / html", this type is always selected and cannot be deleted.
Brotli Compression + GZip Compression
You can activate both content compression options at the same time.
The method of data compression, in this case, depends on the type of a file being processed, "Brotli Compression" settings in the personal account, and whether the user's browser supports a particular type of compression.
If the selected MIME types in the "Brotli Compression" option match the GZip Compression default file extensions, the Brotli compression algorithm has a higher priority, but only if the user's browser supports this type of compression.
If in the "Brotli Compression" option is not set a MIME type that at the same time is included in the GZip Compression default extensions, such filetype is compressed using the GZip method.
For example, you have activated both options and set "text/html" and "application/json" extensions in the "Content types" for Brotli compression settings.
When a user requests a file, for example with the "text/html" extension, a browser sends to the CDN servers the headers listing the supported compression formats.
Brotli has a higher priority and if the user's browser supports Brotli compression, the content will be compressed on the Origin Shielding, despite the fact that this MIME type is supported by the "GZip Compression".
If the browser does not support Brotli compression, files will be compressed using the GZip method.
"Brotli Compression" and "GZip Compression" options work together only if the "Origin Shielding" option is enabled.
To activate the “Origin Shielding” option, please, contact the Support Team.
Compression settings in Resource Settings and Rules
2. In order to the CDN server requests compressed content from the origin for certain files that are under the rule, but for all other files compression occurs on the CDN using the selected compression method, enable "Gzip compression", "Brotli Compression" or both of them in the Settings tab, and in resource Rules set the "Origin Pull Compression" option.
3. In order to the CDN server requests compressed content from the origin for all files and for certain files compression occurs on the CDN using the selected compression method, enable "Origin Pull Compression" option in the Settings tab and in the resource Rules also add "Origin Pull Compression" option, but leave it disabled, then add and enable "Gzip compression", "Brotli Compression" or both of them.