Today I uploaded a sitemap.xml file to my site, then realised that my server wasn't set up to gzip .xml files. However, CloudFlare still gzipped it before sending to my browser.

This got me wondering, does it matter what the gzip level is on my origin? Obviously, if I enable gzip compression, it will speed up the transfer between my origin and Cloudflare, but will it make a difference between the end-user and the Cloudflare datacenter?

The final point I'm trying to get to here is, I'm wondering whether it's worth using Nginx's gzip_static and Zopfli compression on my origin server, or if Cloudflare will recompress my files with a different algorithm.

1 Answer 1


Does CloudFlare gzip resources?

Yes, CloudFlare gzips resources that pass through our network. We also gzip items based on the browser's useragent to help speed up page loading time.

If you're already using gzip we will honor your gzip settings as long as you're passing the details in a header from your web server for the files.

Source: https://support.cloudflare.com/hc/en-us/articles/200168086-Does-CloudFlare-gzip-resources-

To check whether the origin server’s compression level affect the CloudFlare’s compression level to the user/browser, you can check your server’s access log to determine the bytes sent, and the content-length received on your browser.

  • 2
    Yep, I've read through all of CloudFlare's support documentation and such, but they don't answer the question of whether they open up and subsequently recompress files (thereby making it unimportant which level the origin used), or whether they store the gripped version created by my origin server.
    – John Cave
    Jul 27, 2015 at 7:00
  • 3
    I just checked my logs, it seems it is unimportant on the compression level used on the origin. The level determines the file size being transferred from the origin to CF. CF then uses its own compression level to the users. You can check your server's access log to determine the bytes sent, and the content-length received on your browser. Jul 27, 2015 at 7:12
  • Awesome idea, thanks @Tan. I'll give this a go myself tomorrow just out of curiosity. I was fairly sure this was the case, as Cloudflare sometimes opens my CSS files and removes all the comments from it but doesn't at others. I feel this should be made clearer in their documentation, though.
    – John Cave
    Jul 27, 2015 at 11:38
  • Updated..... :) Jul 28, 2015 at 5:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.