Search code examples
cachingimmutabilitycdncloudflare

Is clouldflare cdn only for static FILES? What about constant RESPONSES?


My server's replies are immutable. Can I somehow cache them to prevent output bandwidth usage?


Solution

  • Cloudflare is able to cache almost any kind of response, when configured to do so. One method is to use a page rule set to "Cache Everything", and "Origin Cache Control" alongside setting Cache-Control header in your HTTP response - https://developers.cloudflare.com/cache/about/cache-control

    You'll want to read through their full documentation however to get the full picture on how / why their caching behaves the way it does, along with all your options - https://developers.cloudflare.com/cache/