Why Does a CDN Break Dynamic WooCommerce Content?
Why This Happens
CDNs like Cloudflare are built to cache and serve content from edge servers close to each visitor, which is excellent for genuinely static assets and pages, but requires explicit configuration to distinguish WooCommerce's dynamic, per-customer pages from the rest of the site. Without that distinction, the CDN treats everything the same way, which for cart, checkout, and account pages is exactly the wrong behavior.
Common Causes
- No explicit cache-bypass rules configured for cart, checkout, and My Account URLs, leaving the CDN's default page-caching behavior to apply uniformly across the whole site.
- A CDN caching AJAX/API endpoints WooCommerce relies on for dynamic functionality (updating totals, checking stock), causing stale or incorrect responses to those background requests.
- Cookie-based personalization not being respected by the CDN's caching logic, if the CDN isn't configured to vary its cache based on the presence of a session cookie.
- Not using WooCommerce-specific CDN integration guidance, since major CDN providers generally publish specific recommended configurations for WooCommerce that address these exact issues, worth following directly rather than relying on generic caching defaults.
How to Configure This Properly
- Create explicit cache-bypass (page rules or equivalent) for cart, checkout, and My Account URLs at the CDN level, ensuring these always pass through to the origin server fresh.
- Follow the CDN provider's specific WooCommerce configuration guidance if published, rather than relying on generic default settings.
- Test as two separate customer sessions (a normal browser and a private window) to confirm dynamic pages genuinely show independent, correct content for each.
- Confirm AJAX/API endpoints used for checkout totals and stock checks are also excluded from caching.
Checking what the CDN is doing to dynamic pages
- Read the response headers for the cart, checkout and My Account pages, and for a request containing
wc-ajax. On Cloudflare,cf-cache-statusshould beDYNAMICorBYPASS, notHIT. Other CDNs use headers such asX-Cache. - Test with two visitors. Add an item to the cart in one browser, then open the cart in a different browser or device. Each should see their own cart. If they see the same one, caching is serious and urgent.
- Check both kinds of rule. Bypass by path for
/cart/,/checkout/and/my-account/, and bypass by cookie, for the WooCommerce session and cart cookies and for logged-in users. - Check rule order. CDNs apply rules in order, so a broad caching rule above a specific bypass can override it.
HTML versus static files
A safe default is to let the CDN cache images, CSS, JavaScript and fonts aggressively, and leave HTML uncached unless you have a tested reason. A "Cache Everything" style rule is the most common cause of this problem, since it makes the CDN treat HTML pages like static files.
Need CDN configuration fixed or set up properly for WooCommerce? See WooCommerce fixes.