Mamba CDN Integration

Mamba integrates with your CDN to mirror purges and keep edge caches hot and accurate. It supports Cloudflare, Bunny.net, and generic webhooks, with options for tag-based purging and settings that align with Mamba’s page and API caching.
➡️ Support for additional CDN providers will be added in future releases.


What It Does

  • Mirrors Mamba cache operations to your CDN:
    • Purges the right pages when products, prices, categories, or templates change
    • Supports tag-based purging (where available) to clear only what changed
  • Harmonizes cache headers:
    • Uses aligned Cache-Control with s-maxage, stale-while-revalidate, and stale-if-error
    • Keeps CDN edges responsive even during origin revalidation
  • Keeps edge caches hot:
    • Warmups at origin naturally feed the CDN so first visitors see edge HITs too

Providers

Cloudflare

  • Configure Zone ID + API Token (with cache purge permissions)
  • Optional: detect APO and include device/lang/geo keys in purge context
  • Optional: send Cache-Tag headers for tag-based purging
  • One-click “Apply Recommended Settings” to set sensible defaults

Bunny.net

  • Configure Pull Zone ID + API Key
  • Optional: send CDN-Tag headers for tag-based purging
  • Optional: enable wildcard/prefix purges for media families
    • Note: Not compatible with Perma-Cache

Generic Webhook

  • Provide a webhook URL (+ optional secret)
  • Mamba POSTs purge events for custom invalidation logic

Coming Soon

  • Additional CDN providers will be supported in upcoming releases to broaden native integration options

How Purging Works

  • URL-level purge
    Clears specific pages when products, categories, or tags change, or when an admin clicks Purge This Page
  • Tag-based purge (recommended)
    • Sends Cache-Tag/CDN-Tag headers on HTML/JSON
    • When content changes, Mamba purges by tag so the CDN clears only related content
  • Wildcard/prefix purge (Bunny option)
    • Useful for media families derived from the same source
    • Avoid if using Bunny’s Perma-Cache

Harmonized TTLs

  • Edge TTL
    Configure your CDN TTL to match catalog freshness (e.g., a few hours at the edge)
  • Browser TTL
    Typically shorter, aligned with page/browser cache policies
  • Resilience
    stale-while-revalidate and stale-if-error keep edges responsive during revalidation or temporary origin issues
  • Alignment
    Keep CDN TTLs in step with Mamba’s cache settings so browser, edge, and origin act consistently

Setup Steps

  1. Choose a provider: Cloudflare, Bunny.net, or Generic Webhook
  2. Provide credentials:
    • Cloudflare → Zone ID + API Token
    • Bunny → Pull Zone ID + API Key
    • Webhook → URL (+ optional secret)
  3. Enable tags (recommended): toggle “Send Cache-Tag/CDN-Tag headers” so HTML/JSON responses emit tags
  4. Optimize provider settings:
    • Cloudflare → click “Apply Recommended Settings”
    • Bunny → enable wildcard purges only if needed, not with Perma-Cache
  5. Test: use Test Connection, Test URL Purge, and Test Tag Purge buttons in the CDN tab

Troubleshooting

  • Purges don’t seem to take effect
    → Verify credentials and permissions. Use the Test Connection and Test Purge tools. Confirm correct Zone ID (Cloudflare) or Pull Zone (Bunny).
  • Tag-based purge isn’t clearing expected content
    → Ensure “Send Cache-Tag/CDN-Tag headers” is enabled. Confirm your CDN supports tag-based purge and check headers are present in responses (curl -I or browser devtools).
  • APO/device/geo variants on Cloudflare
    → Keep “detect APO and include cache-key headers” enabled so purges reach the right variants.
  • Bunny wildcard purges not working
    → Confirm Perma-Cache is not enabled. If it is, use tag or URL purges instead.

Copyright 2025 - Mamba


Mamba mascot