Allow full cache control via HTTP headers

Currently caching URLs without file suffixes is difficult. For example, I have a page generating images in different formats, and the format is told in the MIME type. Further, the URL changes by language, so there are around 30 distinct URLs for the same script.

I do not want to add a file suffix since it will often be incorrect (depending on which format the file is requested by the client). Adding 30 distinct URLs as page rules is immensely tedious.

A simple change would be a custom HTTP header, which would tell Cloudflare how to cache this particular page. For example, it could specify:

  • handle this by the default rules
  • always cache/uncache this page
  • cache/uncache this page if there is no session present
  • cache the page following the Cache-control headers, overriding other rules

Basically this header would give the user full control on how each individual page is cached, not going through the complex caching rules currently in place.

A similar approach would be to allow page rules to specify caching based on page headers. Basically the page itself would provide the page rules for Cloudflare, and this is done inside custom headers.

Is this the same as modifying the HTTP Response Header cdn-cache-control or s-maxage in cache-control?

Effectively you can control the Browser Cache TTL and Edge Cache TTL on the origin using .htaccess or similar.