#14352·wagtail

Allow Cloudflare frontend cache purge batch size to be configured

Author: MebinAbrahamCreated Jun 22, 2026Updated Oct 1, 2026
Labelstype:Enhancementstatus:Needs Review

Problem statement

The Cloudflare frontend cache backend currently chunks purge requests using a fixed batch size. This works well as a default, but it means projects cannot tune the number of URLs sent per purge request without subclassing CloudflareBackend.

This is a bit awkward for deployments where the Cloudflare API limit, plan, or operational preference differs from Wagtail’s default. The setting is deployment specific, but right now it is hardcoded in the backend class rather than configurable through WAGTAILFRONTENDCACHE.

Proposed solution

Add an optional per-backend setting for the Cloudflare purge batch size, for example:

python
WAGTAILFRONTENDCACHE = {
    "cloudflare": {
        "BACKEND": "wagtail.contrib.frontend_cache.backends.CloudflareBackend",
        "PURGE_BATCH_SIZE": 100,
        ...
    }
}

If the setting is not provided, Wagtail should keep the current default behaviour.

The backend could read this value during initialisation and use it when splitting URLs in purge_batch(). It would also be useful to document that it should not exceed the limit supported by Cloudflare’s API/account plan.

Alternative solutions

The current workaround is to subclass CloudflareBackend, override the class-level chunk size, and point WAGTAILFRONTENDCACHE["BACKEND"] at the custom subclass.

That works, but it feels like unnecessary boilerplate for what is really backend configuration. It also makes a small operational tuning value live in the project code rather than alongside the rest of the Cloudflare cache settings.

Additional context

The main benefit is making the Cloudflare backend easier to configure in production without requiring a custom backend subclass.

Working on this

Contribute to the discussion to help this move forward. Explain your use cases, discuss possible solutions, research how to adapt existing code, or compatibility concerns.

Once others agree with the proposed changes, anyone can contribute to this. View our contributing guidelines. Add a comment to the issue to explain what approach you are taking.