Cloudflare Cache Response Rules: Fix Headers Safely at the Edge

Illustrated infographic summarizing: Cloudflare Cache Response Rules: Safer Header Fixes at the Edge

By Greg Nowak. Updated 18 November 2026.

If every visit to a public article reaches your origin server, your CDN may be doing less work than you expect. Cloudflare Cache Response Rules can correct selected headers before Cloudflare decides whether to cache the response. That can be useful when an application fix needs to wait for a release.

The first question is whether visitors can safely share the same response. A published page may still contain personalised navigation, pricing or preview content. Before changing headers, establish what varies, which routes are public and how published updates will reach visitors.

Choose the rule that addresses the problem

A Cache Rule evaluates the incoming request and controls cache eligibility. A Cache Response Rule runs after the origin responds and can modify cache directives, manage cache tags or strip selected headers. It cannot make an ineligible request eligible, so HTML pages may need a Cache Rule first. Cloudflare’s Cache Response Rules overview explains this distinction. The feature is available on every plan and requires proxied DNS records.

Read the response before changing anything

Use a real GET request against a representative public URL:

curl -sS -D - -o /dev/null https://www.example.com/articles/example

Record CF-Cache-Status, Cache-Control, CDN-Cache-Control, Set-Cookie, Vary, Age and CF-Ray. Repeat the same request without adding a random query string. Compare the data-centre suffix in CF-Ray to help keep the comparison consistent.

Cache status What it tells you Next check
DYNAMIC The request was ineligible for caching. Check Cache Rules, request method and Development Mode.
BYPASS The response or configuration prevented storage. Inspect cache directives, cookies, authorisation, Vary: * and object size.
Repeated MISS A cacheable response keeps missing. Check purges, changing cache keys and data centres.
HIT Cloudflare served a cached response. Verify its content and freshness.
Use the cache status to choose the investigation before choosing a fix.

A first MISS after a purge is expected. Also inspect the origin configuration: Cloudflare-CDN-Cache-Control is not forwarded to visitors, so a client-side header capture cannot reveal the whole policy. Cloudflare’s uncached-response guidance covers these causes.

Prove which pages can share a cached copy

Start with one published content family, such as articles or public documentation. Keep accounts, carts, checkout, administration and previews outside the experiment. Check query parameters as well as paths: a preview may use the same URL with an extra parameter.

Compare the rendered page for anonymous visitors, signed-in users and visitors with relevant preference cookies. Currency, consent and experiments can change an apparently public page. Configure request-time cache bypass for session or authorisation state wherever those requests must remain private; excluding them only from the header fix does not establish that protection.

If the origin sends Set-Cookie, identify its owner and purpose before stripping it. Removing the header does not remove personalisation already present in the response body. If nobody can explain the cookie, leave that route out until they can.

Create one narrow, reviewable header fix

In the dashboard, open Cache > Cache Rules > Cache Response Rules and create a rule with a descriptive name. Use a custom filter rather than applying the change to all traffic. Cloudflare’s dashboard instructions cover the available actions and draft option.

For an initial article test, scope the rule to the hostname, a specific published path family, GET or HEAD, and origin status 200. Exclude preview parameters and session-bearing requests. A cookie-free, query-free test can make the first rollout easier to inspect, provided the page has no other variations. If an Origin Rule rewrites the host, match the hostname received by the origin.

Change only the proven blocker. For example, remove private only after confirming it was incorrectly applied to a genuinely public response. The Cloudflare only option lets a directive change affect Cloudflare’s caching while visitors receive the original directive. Choose the edge lifetime according to how long the business can tolerate an outdated page.

Keep ETag and Last-Modified unless there is a specific reason to remove them. Cloudflare documents that stripping either through these rules disables Smart Edge Revalidation for that response. See the available settings before combining header actions.

Check rule order and behaviour after expiry

Cache Response Rules take precedence over conflicting Cache Rule settings. Any matching Cache Response Rule defaults the response to Origin Cache Control behaviour, and the last matching rule wins for a shared setting. Use Rules simulator to check matches, then verify the effective policy with live requests.

If background revalidation matters, test beyond the freshness period. With Origin Cache Control enabled, directives including s-maxage and must-revalidate prevent stale serving even alongside stale-while-revalidate. Cloudflare’s revalidation guidance recommends origin max-age plus stale-while-revalidate, with a separate Edge Cache TTL, when different browser and edge lifetimes are needed. Check for conflicting response-rule overrides.

Verify publishing as well as cache hits

Save the previous configuration, deploy the narrow change and purge the affected public test URLs. Repeat the request and inspect the page itself. Then test login, previews and relevant preferences. Publish an edit and confirm the normal purge process exposes it within the agreed window.

Watch cache status and origin traffic for the affected routes. Record the rule’s purpose, owner and rollback steps. If rolling back, disable the change and purge any copies stored under the incorrect policy. Keep the application header fix on the backlog with an owner.

If the behaviour spans several templates or suppliers, talk to Greg about a focused Cloudflare cache audit. The useful outcome is a tested policy your business and agency team can maintain, with clear publishing and rollback procedures.

Related on GrN.dk

Need help with this kind of work?

Talk to Greg about a Cloudflare cache audit Get in touch with Greg.

Sources

Latest articles

See how SharePoint access changes reach internal AI search, and test how long revoked content can still appear in results, generated answers, and citations.

At month-end, reconcile Shopify Payments against your bank statement and e-conomic. Use the payout ID to trace fees, refunds, and payouts that reach your bank the following month.

Trace an intermittent NGINX 502 through Cloudflare, upstream attempts, and application logs so you can see where the request failed and who should pick it up.

Find the apps, scripts and printers that still send mail through Microsoft 365 with a mailbox password, then test a replacement before the December 2026 change.

Find subscriptions and insurance expenses in e-conomic that should be spread over several months. See how AI reads the supporting documents and how your finance lead approves the proposed allocations.

Before relying on an AI project briefing, check which files it covered. A practical workflow for tracking documents, recording gaps and verifying key claims.

Check whether your contact form rejects missing or invalid Turnstile tokens, handles failed checks for genuine users and delivers accepted enquiries to your team.

Compare Bing citations, identifiable AI visits and verified enquiries to see which pages deserve attention before you increase your AI search marketing budget.

Teamtailor is phasing out Riminder on 21 November 2026. Check your parser settings, contact fields and integrations, and make sure you have a process for deleting applicant data.

WordPress jobs running late? Learn how to separate scheduling problems, task errors and a growing backlog, then choose the right scheduler or runner.