Gzip is a method of data compression when a file is divided into small chunks and each of them is compressed to reduce the overall file size. When files are downloaded they are automatically unzipped so the end user receives the original file without packet loss. Typically, Gzip compression reduces file size by 70% and can be as high as 90%.
Origin supports Gzip Compression
For the correct G-zip work with the CDN two HTTP-Headers will be needed - Accept-Encoding: gzip/deflate and Vary: Accept-Encoding.
While processing a request from the end users, CDN servers check if the Accept-Encoding HTTP header contains gzip or deflate, which means that the browser can process compressed content. In this case, a compressed version of the HTTP object will be sent to the end user. If there are no such directives, a CDN will deliver an uncompressed version of a file.
But if your server doesn't return Vary: Accept-Encoding header, in CDN will be cached the first requested file whether it is compressed or not. It can be an issue if it is necessary to receive a non-compressed file from CDN, but only the compressed one is cached. If your server returns Vary: Accept-Encoding, two versions of a content (compressed and uncompressed) are stored in CDN.
Origin doesn’t support GZIP Compression
Only uncompressed version of the content is stored in CDN. Regardless of how the content is requested, CDN will serve uncompressed files from cache.
Filetypes which can be compressed
How to enable Gzip compression on origin
You can configure Gzip support on your origin. It’s convenient because you can set your own compression preferences for different types of content.
Header append Vary User-Agent
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0 no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|pdf|swf|ico|zip|ttf|eot|svg)$ no-gzip
#Optionally, GZip level of compression can be added to the NginX server block using the following directive:
gzip_disable "MSIE [1-6]\.";
How to enable Gzip compression on CDN
You can enable gzip compression directly on CDN Edge servers. In this case, CDN will always request uncompressed content from your origin and compress it on the CDN’s side.
Please follow this manual to enable Compression on CDN.