Cloudflare Dynamic Content Purging: Why Are My Updates Not Live?
0
I'm tearing my hair out trying to get Cloudflare's dynamic content purging to work for my SaaS. Our users are seeing stale data, and I'm completely stuck!
- Context: We have a dashboard with frequently updated user data and analytics. When a user makes a change or new data comes in, we need that reflected immediately. We're using Cloudflare for performance, but this cache issue is killing us.
- Problem: Even after triggering cache purges, users often see old data for several minutes, sometimes longer. It's like the real-time content updates we need just aren't happening reliably.
- What I've Tried:
- Using Cloudflare's Purge by URL (single and multiple) via API.
- Purging Everything via API (as a last resort, which is terrible for performance).
- Setting
Cache-Control: no-cache, must-revalidateon relevant API endpoints (though Cloudflare still seems to cache it). - Checked Page Rules โ nothing seems to be overriding the cache control.
- Verified origin server is sending correct
ETagandLast-Modifiedheaders.
- Example of Failure (Dummy Error Log/Console Output):
// User A updates their profile. // API purge for "/api/user/A/profile" is triggered. // User A refreshes browser. // Network tab shows: // Request URL: https://mysaas.com/api/user/A/profile // Status: 200 OK (from Cloudflare cache) // CF-Cache-Status: HIT // Age: 120 // (Shows 2 minutes old content!) // Expected: CF-Cache-Status: DYNAMIC or MISS, Age: 0 - My Question: What am I missing? Is there a specific header or Cloudflare setting that guarantees immediate cache invalidation for dynamic content?
0 Answers
No answers yet.
Be the first to provide a helpful answer!
Your Answer
You must Log In to post an answer and earn reputation.