File compression
File compression helps reduce the load on the content source and speed up the delivery of content to end users. You can use one of two free types of compression:
- compression on CDN servers using GZip and Brotli algorithms;
- compression at the source.
Images of .jpg
and .png
formats are not processed during compression on CDN servers, and it is not recommended to process them during compression on the source. To compress such images, you can connect Image Stack paid image compression.
If you want faster downloads without compression, optimize the delivery of large files.
Not all compression and optimization types can be used together. To see their characteristics and compatibility, see the Compression and Optimization Comparison table.
Comparison of compression and optimization types
Compression on CDN servers
Principle of operation
Content on the source is stored uncompressed and compressed when it hits the CDN server cache.
You can enable GZip and Brotli compression, the minimum file size for compression is 128 bytes.
If you want to use Brotli compression, source shilding must be enabled for the resource, since the compression is performed on the shilding server.
You can use one of the algorithms or both. If both algorithms are enabled and supported in the browser, and the file format is supported by both algorithms, Brotli will be prioritized.
If in a request to the CDN the user's browser does not send headers listing supported compression formats, such as Accept-Encoding: gzip, deflate, br,
the content is delivered uncompressed.
List of supported formats for compression
Enable compression on CDN servers
Enable GZip compression
Enable Brotli compression
- In the Control Panel, on the top menu, click Products and select CDN.
- Open the CDN resource page → Settings tab.
- Open the Content card.
- Check the GZip Compression on CDN servers checkbox.
- Click Save. GZip compression will work within 30 minutes.
- Make sure to enable source shilding.
- In the Control Panel, on the top menu, click Products and select CDN.
- Open the CDN resource page → Settings tab.
- Open the Content card.
- Check the Brotli Compression checkbox.
- Click Save. Brotli compression will start working within 30 minutes.
Compression at source
Principle of operation
Content is compressed at the source and enters the CDN server's cache in an already compressed form. This helps to reduce the time of content delivery, as CDN servers do not waste time processing it.
Enable compression on the source
- Make sure the source server is configured to compress files using the Gzip algorithm. If compression is not configured or is not using a different algorithm, uncompressed content will always be output.
- In the Control Panel, on the top menu, click Products and select CDN.
- Open the CDN resource page → Settings tab.
- Open the Content card.
- Check the Compress files on source checkbox.
- Click Save. Compression on the source will work for 30 minutes.