pahy / ignitercf
Cloudflare Cache Purge (unofficial) - Automatically purge Cloudflare cache when content changes. Unofficial TYPO3 integration - not affiliated with Cloudflare, Inc.
Requires
- php: ^8.1
- typo3/cms-backend: ^12.4 || ^13.4
- typo3/cms-core: ^12.4 || ^13.4
- typo3/cms-frontend: ^12.4 || ^13.4
README
Warning
This extension is work in progress and not yet production-ready. Use at your own risk.
Automatically purge Cloudflare cache when content changes in TYPO3 v12/v13.
Getting Started
1. Create Cloudflare API Token
- Open the Cloudflare Dashboard
- Go to Profile (top right) > API Tokens
- Click Create Token
- Select Custom Token > Get started
- Configure:
- Token name:
TYPO3 IgniterCF - Permissions:
- Zone > Cache Purge > Purge
- Zone Resources:
- Include > Specific zone > Select your zone(s)
- Token name:
- Click Continue to summary > Create Token
- Copy the token (displayed only once)
2. Get Zone ID
- In Cloudflare Dashboard, select your domain
- On the Overview page, find Zone ID on the right side
- Copy this ID
3. Set Environment Variables
In .env (TYPO3 root):
# Zone ID (site-specific or global): IGNITERCF_ZONE_MAIN=your-zone-id IGNITERCF_ZONE_ID=fallback-zone-id # Global fallback # API Token (site-specific or global): IGNITERCF_TOKEN_MAIN=your-cloudflare-api-token IGNITERCF_API_TOKEN=fallback-token # Global fallback # Multi-domain example: IGNITERCF_ZONE_MAIN=abc123def456 IGNITERCF_ZONE_SHOP=xyz789ghi012 IGNITERCF_TOKEN_MAIN=token-for-main-zone IGNITERCF_TOKEN_SHOP=token-for-shop-zone
Naming convention: Site identifier becomes uppercase, hyphens become underscores:
main→IGNITERCF_ZONE_MAIN/IGNITERCF_TOKEN_MAINmy-shop→IGNITERCF_ZONE_MY_SHOP/IGNITERCF_TOKEN_MY_SHOP
4. Configure Site (Alternative to Environment Variables)
If not using environment variables for Zone ID, edit config/sites/{site-identifier}/config.yaml:
# Add at the end of the file: cloudflare: zoneId: 'your-zone-id-here' # Optional if IGNITERCF_ZONE_* is set enabled: true
Multi-domain example (config.yaml):
# config/sites/main/config.yaml cloudflare: zoneId: 'abc123def456' enabled: true # config/sites/shop/config.yaml cloudflare: zoneId: 'xyz789ghi012' # Different zone! enabled: true
Note: Environment variables take precedence over config.yaml settings.
5. Extension Configuration (optional)
In TYPO3 Backend: Settings > Extension Configuration > ignitercf
| Setting | Default | Description |
|---|---|---|
| Enable Cloudflare Integration | Yes | Global kill switch |
| Purge on Clear All Caches | Yes | Also purge CF on "Clear all caches" |
| Auto-Purge on Content Change | Yes | Automatically purge on content changes |
| Enable Cache-Control Middleware | Yes | Prevent CF caching for BE users |
| Debug Mode | No | Verbose logging |
6. Clear Cache
vendor/bin/typo3 cache:flush
# Or with DDEV:
ddev typo3 cache:flush
7. Test
Test 1: Auto-Purge on Content Change
- Edit a content element in the backend
- Save
- Check log:
var/log/typo3_*.loggrep -i cloudflare var/log/typo3_*.log | tail -5
- Expected output:
Cloudflare cache purged
Test 2: Middleware (Cache-Control Header)
# Without BE cookie (should NOT have no-store header): curl -I https://your-domain.com/ # With BE cookie (should have no-store header): curl -I -H "Cookie: be_typo_user=test" https://your-domain.com/
Test 3: Cache Dropdown
- In backend, click the cache icon (top right)
- "Clear Cloudflare Cache (All Zones)" should appear
- Click it
Test 4: Context Menu
- Right-click on a page in the page tree
- Select "Clear Cloudflare Cache"
- Confirm
Test 5: Connection Test
Test your Cloudflare configuration (token validity + zone access):
Via CLI:
# Test all sites: vendor/bin/typo3 ignitercf:test:connection # Test specific site: vendor/bin/typo3 ignitercf:test:connection main
Via Backend Module:
- Go to System > IgniterCF > Configuration
- Click Test button next to a configured site
- Results show token and zone status
Troubleshooting
Problem: "Cloudflare API Token is not configured"
Solution: Check environment variable:
# In DDEV: ddev exec printenv | grep IGNITERCF # Local: printenv | grep IGNITERCF
Variable must match site identifier (uppercase, hyphens become underscores).
Problem: Purge not working
Check 1: Is API token valid?
curl -X GET "https://api.cloudflare.com/client/v4/user/tokens/verify" \ -H "Authorization: Bearer YOUR_TOKEN"
Check 2: Is Zone ID correct?
- Cloudflare Dashboard > Domain > Overview > Zone ID
Check 3: Check log
grep -i "cloudflare\|ignitercf" var/log/typo3_*.log
Problem: Backend preview is cached
Solution 1: Is middleware active?
- Extension Configuration > "Enable Cache-Control Middleware" enabled
Solution 2: Set up Cloudflare Cache Rule:
- Cloudflare Dashboard > Caching > Cache Rules
- New Rule:
Cookie contains "be_typo_user"> Cache: Bypass
Enable Debug Mode
// config/system/additional.php $GLOBALS['TYPO3_CONF_VARS']['LOG']['Pahy']['Ignitercf']['writerConfiguration'] = [ \TYPO3\CMS\Core\Log\LogLevel::DEBUG => [ \TYPO3\CMS\Core\Log\Writer\FileWriter::class => [ 'logFileInfix' => 'ignitercf' ], ], ];
Log: var/log/typo3_ignitercf_*.log
Configuration Overview
| What | Where | Example |
|---|---|---|
| Zone ID | Environment Variable | IGNITERCF_ZONE_MAIN=abc123 |
| Zone ID (fallback) | Site config.yaml | cloudflare.zoneId: 'abc123' |
| API Token | Environment Variable | IGNITERCF_TOKEN_MAIN=... |
| Global Settings | Extension Configuration | Backend > Settings |
| Enable/disable site | Site config.yaml | cloudflare.enabled: false |
Lookup Order (Zone ID & API Token):
IGNITERCF_ZONE_{SITE}/IGNITERCF_TOKEN_{SITE}(site-specific)IGNITERCF_ZONE_ID/IGNITERCF_API_TOKEN(global fallback)- Site config.yaml (legacy)
Features
- Auto-purge on content changes (pages, tt_content)
- Multi-site / multi-zone support
- "Clear all caches" integration
- Cache dropdown entry
- Context menu in page tree
- CLI commands for automated purges
- Scheduler tasks for scheduled purges
- Connection test (token + zone verification)
- Backend module with statistics and configuration status
- Middleware prevents CF caching for BE users
- Batch purge (max 30 URLs per request)
- TYPO3 v12 + v13 compatible
CLI Commands
IgniterCF provides console commands for cache purging via command line.
Purge All Zones
vendor/bin/typo3 ignitercf:purge:all
# With DDEV:
ddev typo3 ignitercf:purge:all
Purge Specific Zone
vendor/bin/typo3 ignitercf:purge:zone --site=main
# With DDEV:
ddev typo3 ignitercf:purge:zone --site=my-shop
Purge Specific Page
# All languages: vendor/bin/typo3 ignitercf:purge:page --page=123 # Specific language: vendor/bin/typo3 ignitercf:purge:page --page=123 --language=1 # With DDEV: ddev typo3 ignitercf:purge:page --page=123
Test Connection
Test Cloudflare API token and zone access for your sites:
# Test all configured sites: vendor/bin/typo3 ignitercf:test:connection # Test specific site: vendor/bin/typo3 ignitercf:test:connection main # With DDEV: ddev typo3 ignitercf:test:connection
Output shows:
- Token validity (active/expired/invalid)
- Zone access (accessible/forbidden/not found)
- Response time
Scheduler Tasks
IgniterCF provides scheduler tasks for automated or scheduled cache purges.
Setting Up Tasks
- Go to System > Scheduler
- Click Add task
- Select an IgniterCF task:
- IgniterCF: Purge All Zones - Purges all configured zones
- IgniterCF: Purge Zone - Purges a specific zone (select site)
- IgniterCF: Purge Page - Purges a specific page (enter page UID)
- Configure frequency (e.g., daily, hourly)
- Save
Task Configuration
| Task | Fields | Description |
|---|---|---|
| Purge All Zones | - | Purges all configured zones |
| Purge Zone | Site | Dropdown for site selection |
| Purge Page | Page UID, Language UID | Page UID (required), Language UID (-1 = all) |
Support
For issues: Enable debug mode and check logs (var/log/typo3_ignitercf_*.log).
Author: Patrick Hayder
License: GPL-2.0-or-later
Not affiliated with: Cloudflare, Inc.