import { createSignal, Show, onMount } from 'solid-js'; import { Button, Text, ProBadge } from '@components'; import { useLicense } from '@util/context'; import API from '@util/api'; import CloudflareSetup from './CloudflareSetup'; import CloudflareStatus from './CloudflareStatus'; export default function CloudflareSection() { const { isLocked, shakePromo } = useLicense(); // Initial status from localized script (instant first paint). const initialStatus = window.ajaxpress_admin_vars?.cf_status || { connected: false, enabled: false }; const [status, setStatus] = createSignal(initialStatus); const [checking, setChecking] = createSignal(initialStatus.connected); // Set the status and write it back to the localized blob. The admin is a // hash-router SPA, so leaving this tab and returning remounts this // component - without the write-back it would re-read the status from page // load and show a stale (dis)connected screen. Connection state lives in // WordPress; this just keeps the in-page copy honest between fetches. const applyStatus = (next) => { setStatus(next); if (window.ajaxpress_admin_vars) { window.ajaxpress_admin_vars.cf_status = next; } }; const fetchStatus = async () => { setChecking(true); try { const res = await API.get('cf/status'); if (res.data?.success) { applyStatus(res.data.status); } } catch (err) { console.error('Failed to verify CF connection:', err); } finally { setChecking(false); } }; // Always re-verify against WordPress on mount, not only when the localized // status already reads connected. A site that connected (or disconnected) // after this page loaded would otherwise keep showing the state it had at // load time every time you navigate back to this tab. onMount(() => { if (isLocked()) { setChecking(false); return; } fetchStatus(); }); const handleConnected = fetchStatus; const handleDisconnected = () => { applyStatus({ connected: false, enabled: false }); }; return (

Super Cache by Cloudflare

This is not another caching plugin. Your pages are stored on Cloudflare's own network and served from whichever of its 330+ locations is nearest your visitor - typically in under 10ms, anywhere in the world. Your server is not involved at all.

{/* Locked state - show disabled form */}

Create a token with these permissions:{' '} Create token

  • Zone : Zone : Read
  • Zone : Cache Purge : Purge
  • Zone : Worker Routes : Edit
  • Account : Workers Scripts : Edit
{/* Comparison Table */}

Traditional caching stores data on your origin server. CF Edge caches globally - your content is served from the nearest of 330+ locations worldwide.

WP Rocket LiteSpeed Redis CF Edge
Response ~200ms ~150ms ~180ms ~10ms
Locations 1 1 1 330+
Cost $59/yr Free* $5+/mo Free**

*Requires LiteSpeed server ยท **Requires Cloudflare free plan

{/* Unlocked state - show actual feature */}
); }