A website owner compares a Drupal page on a phone and laptop while checking whether a new version has reached each device

Editorial illustration.

You publish an edit in Drupal, hit refresh, and still see yesterday’s copy. A teammate across town sees the new version. An incognito window shows something else entirely. The reflex for most developers—especially when a client is waiting on WhatsApp—is to run drush cr five times in a row, purge the entire CDN, and hope the right version sticks.

Sometimes that hides the symptom, but it leaves you blind to the actual boundary that failed. Drupal caching is layered by design: internal render and dynamic page caches, aggregated CSS and JavaScript bundles, PHP OPcache, a reverse proxy or CDN like Cloudflare, and finally the visitor’s browser. Clearing everything at once wipes out the evidence and forces a busy production site to rebuild cold caches under traffic. A structured five-minute check usually tells you exactly which layer is holding the stale copy.

Separate what is stale before touching any purge button

Start by naming the exact thing that did not update. “The site is cached” tells you nothing. Write down the full URL, the expected change, and whether the issue affects HTML markup, a CSS or JavaScript file, an uploaded image, or a configuration change like a menu item or view filter.

Next, verify that the change actually reached the server you are testing. I have lost count of how many “cache bugs” turned out to be a CI/CD pipeline deploying to the wrong branch, a symlink still pointing to yesterday’s release directory, or an editor saving a node as a draft instead of publishing it. If you deploy via SSH or containers, check the active release commit or drush cim status before blaming cache. Similarly, if PHP code or Twig templates changed and OPcache is configured with opcache.validate_timestamps=0, reloading PHP-FPM (sudo systemctl reload php8.3-fpm) is what picks up the new files—no amount of Drupal cache clearing will do it.

Compare anonymous, authenticated, and header responses

Never use an administrator session as proof of what visitors see. Open a private window or run curl from your terminal without session cookies to inspect the exact HTTP headers returned to an anonymous user:

curl -sI https://example.com/services/audit

Look closely at headers such as Cache-Control, Age, X-Drupal-Cache, X-Drupal-Dynamic-Cache, and CF-Cache-Status (if behind Cloudflare). Those headers immediately narrow down the culprit:

  • If X-Drupal-Cache: HIT appears alongside an old Date or Age, Drupal’s Internal Page Cache is serving a stored response. That usually points to missing or incomplete cache tags on a custom block or controller.
  • If CF-Cache-Status: HIT is present while bypassing Cloudflare (testing directly against the origin IP or a non-proxied subdomain) shows the new content, Drupal already has the update—the edge CDN is simply holding an older copy until its TTL expires or it receives a purge.
  • If the HTML itself has the new text or class names, but the layout looks broken, inspect the <link rel="stylesheet"> URLs in the page source. Drupal’s asset aggregation generates hashed filenames under sites/default/files/css/ and js/. When a theme asset changes without a rebuild, the HTML may still point to the old bundle hash, or a browser may cache an unversioned static file aggressively.

Clear the narrowest layer that matches the evidence

Once you know which layer is stale, act only on that layer. On the Drupal side, drush cache:rebuild (drush cr) is the right hammer after deploying new modules, Twig templates, service definitions, or configuration imports (drush cim -y && drush updb -y). On a high-traffic site, avoid running drush cr casually in the middle of peak hours because warming every render bin simultaneously can spike database CPU.

When a single piece of content or a specific entity fails to invalidate—common in custom Twig templates or headless endpoints that forgot to bubble cache metadata—you can invalidate just the affected cache tag instead of nuking the entire site:

drush ev "\Drupal::service('cache_tags.invalidator')->invalidateTags(['node:42', 'config:views.view.frontpage']);"

If the problem is aggregated CSS or JavaScript, make sure Drupal’s asset aggregation is rebuilt through the normal release process rather than deleting sites/default/files/css by hand. Manual deletion on multi-node setups or under the wrong Linux user can leave permissions broken so the web server (www-data or nginx) cannot write new bundles.

And if the origin server is already returning fresh bytes while Cloudflare or Varnish still serves yesterday’s page, purge only the affected URL or cache tag at the edge. If you run Drupal behind Cloudflare, configuring the Purge module with cloudflare purgers lets Drupal’s cache tags automatically invalidate edge URLs when editors save nodes, removing the need for manual CDN purges altogether.

Mistakes that make cache bugs repeat

The most tempting shortcut during an urgent fix is turning off Drupal’s render cache or setting Cache-Control: no-store in settings.local.php and leaving it enabled in production. That masks missing cacheability metadata (#cache => ['tags' => [...], 'contexts' => [...]]) while quietly degrading response times for every visitor.

Another trap is testing two slightly different URLs and treating them as identical. A trailing slash, a ?utm_source= query parameter, a language prefix like /ms/ versus /en/, or www versus apex domain can all produce separate cache keys in both Drupal and your CDN. Always test the exact canonical URL an ordinary visitor hits, verify from a clean network or incognito session, and fix the underlying cache metadata or deployment step so the same page does not stall again next week.

For related guides that complement this troubleshooting workflow, see:

Sources