Are 301 and 302 redirects cached by Cloudflare?

If no cache headers are provided (no Cache-Control or Expires) and the url is cacheable (.jpg, .css, .js etc.) then Cloudflare caches both 301 and 302s. We cache 301 for a couple of hours and 302s for a shorter period of time (~20 minutes).

However, if the headers are set, they override these defaults. In particular, Cache-Control: private, no-cache or public, max-age=0 (or some combination) will tell us not to cache.

For urls that do not get cached, if you want to cache the page, you can create a Page Rule and select 'cache everything'. This will make the resource cacheable, as long as the headers allow it.

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