CDN Cache Preload in Craft CMS – Case Study – Varnish and Cloudflare Plugin for Craft CMS

CDN Cache & Preload for Craft CMS

Stack: Craft CMS PHP Twig Varnish Cloudflare Composer GitHub

The Problem

Caching can reduce server load and improve response times. It also creates another task: after content changes, stale pages need to be cleared and important URLs should be warmed again.

Manual cache management is easy to forget and difficult to keep consistent. Projects using both Varnish and Cloudflare need a predictable way to coordinate the two layers.

What I Built

I developed CDN Cache & Preload for Craft CMS 3, 4 and 5. The plugin connects CMS events with cache purging and warming logic.

  • Cache purging: after content changes, the plugin can send PURGE requests to Varnish and Cloudflare,
  • URL warming: URLs can be collected from sitemap.xml and added to a queue,
  • Queued jobs: heavier operations can run asynchronously through Craft Job Queue,
  • Exclusions: selected URLs can be skipped using REGEX rules,
  • Custom operations: individual URLs can be cleared with an optional delay.

Where It Fits

The extension is useful for Craft CMS websites using Varnish, Cloudflare or static rendering where content should refresh in a controlled way after publication.

Availability

The code is publicly available in the Craft Plugin Store and on GitHub. It can be installed with Composer:

composer require cooltronicpl/varnishcache

Gallery

Links

🔗 Craft Plugin Store | GitHub

Are you using Craft CMS with Varnish or Cloudflare? Tell me about the current setup.

Let's Discuss Caching in Craft CMS

I usually reply within 24 hours

Plugin in the official Craft CMS Plugin Store

The plugin preview is blocked until you enable external content.

magnifiercrosschevron-left