How to cache 403 pages?

After switching my site over to cloudflare and addressing some initial issues I’m still seeing a large number of uncached requests which I think occur because the server responds with an error code.

I just set up a 404 page with a cache-control header, but the page is still not getting cached.

For example: https://web-push-book.gauntface.com/unknown-page.html

Returns:

cache-control: 'max-age=86400'
cf-cache-status: BYPASS

Does anyone know what I can do to get cloudflare to cache the request according to the cache-control header?

I have a page rule to cache everything but it doesn’t seem to affect this request.

Thanks,
Matt

Only Enterprise Plan has the capability to set the cache based on HTTP status code.

But your cache everything page rule should apply to all HTML content, including 404/403, provided that the same page rule also has a Edge Cache TTL set.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.