Does Cloudflare honor my Expires and Cache-Control headers for static content?

Yes, Cloudflare will honor the Expires and Cache-Control headers if your origin server returns them.

Note that for cached resources, by default Cloudflare will override the Cache-Control header with the value of the "Browser Cache Expiration" option (by default 4 hours), if:

  • the Cache-Control header on the response from the origin server is less than the TTL described in the "Browser Cache Expiration" setting; or,
  • the origin does not respond with a "Cache-Control" header

It is possible to set the "Browser Cache Expiration" setting to "Respect Existing Headers" meaning Cloudflare will not override or insert a Cache-Control header (unless told to do so by a specific Page Rule).

In order to enable this feature, you should first head to the Caching tab in the Cloudflare Dashboard.

From here you can scroll down to the "Browser Cache Expiration" option and set "Respect Existing Headers":

Still not finding what you need?

The Cloudflare team is here to help. 95% of questions can be answered using the search tool, but if you can’t find what you need, submit a support request.

Powered by Zendesk