Is It Worth Compressing Responses If Using Cloudflare?

May 8, 2025 5 answers
Asked by meter-7eight
I'm wondering if it makes sense to compress responses from my server when I'm already using Cloudflare, which also handles compression. Will compressing responses reduce the payload size between my origin server and Cloudflare enough to justify the extra processing overhead?

Answers

+chess clock!
As far as I know, Cloudflare does compress payloads by default. You can check this in the Network DevTools section by looking at the headers of the response to see if itโ€™s already being compressed.
Reply to this answer
wharfside
If youโ€™re serving brotli compressed responses from your origin, and you donโ€™t enable Cloudflare settings that require examining the payload, it can pass through your compressed responses directly, which is faster. Pre-compressing your assets is generally a smart move, even if you donโ€™t configure passthrough.
Reply to this answer
POSTMARKED
In most cases, the cost of data transfer is higher than the processing needed for compression, so there can still be a significant benefit to compress if you're transferring large amounts of data.
Reply to this answer
focaccia crust!
Generally, compressing data before it reaches Cloudflare may not provide much benefit since running the same compression algorithm twice on the same file yields minimal improvements. You might actually lose more with the additional computational overhead. Itโ€™s worth testing on your own to see if you notice any difference, but odds are you wonโ€™t gain much from it.
Reply to this answer
warp24epi
It really depends on your traffic costs. Reducing the bytes that Cloudflare requests from your origin could save you on infrastructure costs, making compression worthwhile if you're dealing with large amounts of traffic.
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions