CDN & Caching
How InlineCMS delivers content through CDN and handles cache invalidation.
Content delivery model
Section titled “Content delivery model”InlineCMS uses a two-path content delivery strategy:
Visitors → CDN edge (~5ms) → cache miss → API → PostgreSQLEditors → API directly (bypasses CDN, always sees draft state)- Visitors get published content from the CDN edge. On cache miss, the request falls back to the API.
- Editors always bypass the CDN and fetch directly from the API so they can see draft content.
Cache invalidation
Section titled “Cache invalidation”When content is published, InlineCMS automatically sends a cache purge request to your configured CDN webhook:
POST <CDN_INVALIDATION_URL>Content-Type: application/jsonAuthorization: Bearer <CDN_INVALIDATION_SECRET>
{ "projectId": "...", "path": "/about", "action": "purge"}Configuration
Section titled “Configuration”Set these environment variables on the API:
CDN_INVALIDATION_URL=https://your-cdn-provider.com/purgeCDN_INVALIDATION_SECRET=your-webhook-secretOr configure in the dashboard under Settings > CDN.
Without a CDN
Section titled “Without a CDN”If no CDN is configured, all content is served directly from the API. This works fine for low-traffic sites and development. The SDK automatically falls back to the API when no CDN URL is set.
CDN provider examples
Section titled “CDN provider examples”Cloudflare
Section titled “Cloudflare”Use a Cloudflare Worker as the purge webhook that calls the Cloudflare Purge API.
Fastly
Section titled “Fastly”Point CDN_INVALIDATION_URL at Fastly’s Purge API endpoint with your service ID.
Custom
Section titled “Custom”Any HTTP endpoint that accepts a POST with the JSON payload above. The CDN invalidation system is provider-agnostic by design.