kenshodigital/kirby-cloudflare

Enables Cloudflare Cache for pages in Kirby projects.

Maintainers

Package info

github.com/kenshodigital/kirby-cloudflare

Type:kirby-plugin

pkg:composer/kenshodigital/kirby-cloudflare

Transparency log

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-07-02 15:25 UTC

This package is auto-updated.

Last update: 2026-07-02 15:53:45 UTC


README

Enables Cloudflare Cache for pages in Kirby projects.

General

If you’re proxying a website through Cloudflare, static assets are typically already cached. HTML pages aren’t cached by default, though. While this can be easily enabled with a basic Cache Rule in Cloudflare, the CDN cannot determine which pages are cacheable by Kirby’s standards, or when content has been updated in the CMS. It simply caches every page until the cache gets manually purged or expires.

The plugin provides a custom cache driver for Kirby's page cache. This leverages Kirby’s core logic for determining what pages are cacheable and when to flush the cache. Instead of caching pages on the server, the cache driver only sends the appropriate Cloudflare headers, and leaves the actual caching to the CDN.

It also handles purging the cache via API when appropriate, making the overall caching behavior consistent with Kirby’s built-in page cache.

Further reading

Usage

Installation

composer require kenshodigital/kirby-cloudflare ^1.0

Setup

Cloudflare

The domain has to be proxied through Cloudflare and a Cache Rule needs to be set up to actually cache all eligible responses, including HTML pages.

An API token with Cache Purge permission for the domain is also required.

Further reading

Kirby

Enable the page cache and set the cache type to cloudflare in your config.php. Make sure to provide your zone ID along with your API token.

<?php declare(strict_types=1);

return [
  'cache' => [
    'pages' => [
      'active' => true,
      'type'   => 'cloudflare',
      'zone'   => '***',
      'token'  => '***',
    ],
  ],
];
Further reading