Cloudflare Cache TTL by status code: A Guide for Website Owners
Learn how Cloudflare Cache Rules use status-code ranges, Cache-Control, and Edge TTL, including what to review before using the documented one-day example.
Facts that can change should include a source and check date. Benchmark claims should state the plan, region, method, and test period.
What “cache TTL by status code” means#
Cache TTL by status code is a Cloudflare Cache Rules setting that controls how matching responses are cached at the edge according to their HTTP status code. In Cloudflare’s documented example, a rule for a hostname containing example.com makes matching responses eligible for caching, uses the Cache-Control header when present, otherwise follows Cloudflare’s default caching behavior, matches status codes 200 through 599, and sets an Edge TTL of one day. The one-day duration is an example, not a universal recommendation.
Cloudflare describes caching as storing copies of frequently requested content at distributed data centers. Cache Rules let website owners identify which resources can be cached and specify how long they should remain cached. See Cloudflare’s cache documentation.
The documented Cache Rule example#
| Setting | Documented example |
|---|---|
| Match condition | A hostname containing example.com |
| Cache eligibility | Matching responses are eligible for caching |
| Cache-Control behavior | Use Cache-Control when present; otherwise use Cloudflare’s default caching behavior |
| Status-code range | 200 through 599 |
| Edge TTL | One day |
The example uses one status-code range and one Edge TTL. It does not provide a separate duration for each individual status code. Because the range covers both ordinary success responses and error status codes, review whether all responses in that range should be eligible for the same rule.
How to review the rule before using it#
- Confirm the match condition identifies the hostname and responses you intend to control. The documentation uses a hostname containing
example.comas its example. - Confirm that matching responses should be eligible for caching.
- Check the status-code range. The documented range is
200through599; do not treat that range as a requirement for every site. - Review the Cache-Control behavior. In the example, Cloudflare uses
Cache-Controlwhen it is present and otherwise uses its default caching behavior. - Choose the Edge TTL based on how long the selected responses may remain cached for your site. One day is the value shown in Cloudflare’s example, not a prescribed setting.
For the vendor-specific workflow and current field names, follow Cloudflare’s Cache TTL by status code example.
Sources
- Cloudflare: Cache TTL by status code Checked 2026-11-19
- Cloudflare cache documentation Checked 2026-11-19