Enterprise Edge Delivery with Cloudflare

300+ Points of Presence, tag-based cache purge, Cloudflare for SaaS custom hostnames with auto SSL, Workers integration — plus a generous free tier.

Why Cloudflare?

🌍

300+ Global PoPs

The largest CDN network in the world. Edge nodes in virtually every country.

🏷️

Tag-Based Purge

Surgically invalidate groups of images by source, type, or any custom tag — without purging unrelated content. (Enterprise)

🔐

Cloudflare for SaaS

Auto-provision SSL certificates for customer vanity domains. Perfect for multi-tenant platforms.

Workers Integration

Optional edge compute for request routing, header manipulation, and A/B testing at the edge.

How It Works

Client → Cloudflare Edge (300+ PoPs)
            ↓ cache miss
         Tiered Cache (regional shield)
            ↓ cache miss
         Image Foundry Origin
            ↓
         Process image (sharp/libvips) → Disk Cache
            ↓
         Response with Cache-Control, ETag,
         Vary: Accept, Cache-Tag headers

Cache Purging — 3 Strategies

MethodEndpointPlan Required
URL purge (30/batch)DELETE /api/cdn/purgeAll plans
Tag-based purgeDELETE /api/cdn/purge-tagsEnterprise
Full zone purgeDELETE /api/cdn/purge-allAll plans

Image Foundry automatically batches large URL purge requests into 30-URL chunks to comply with Cloudflare's API limits.

Custom Hostnames via Cloudflare for SaaS

Let your customers use their own domain — img.acme.com — with automatic SSL:

# 1. Register the hostname
POST /api/cdn/custom-hostname
{ "hostname": "img.acme.com" }

# 2. Customer adds DNS records:
#    CNAME: img.acme.com → proxy.imgfoundry.io
#    TXT:   _cf-custom-hostname.img.acme.com → verification-token

# 3. Verify SSL status
GET /api/cdn/custom-hostname/img.acme.com/verify
→ { "status": "active", "ssl": { "status": "active" } }

Recommended Cloudflare Settings

SettingRecommendedWhy
Proxy (orange cloud)✓ EnabledRoutes traffic through Cloudflare edge
Cache Everything rule✓ Create ruleCloudflare won't cache dynamic routes by default
Tiered Cache✓ EnabledReduces origin hits via regional shielding
Polish✗ DisabledImage Foundry handles all optimisation
Mirage✗ DisabledConflicts with URL-based transformations
HTTP/3✓ EnabledFastest transport for image delivery

Cloudflare vs Bunny CDN

FeatureCloudflareBunny CDN
PoPs300+197+
PricingPlan-based (free tier)Per-GB ($0.01+)
Tag-based purge✓ (Enterprise)
URL-based purge✓ (30/batch)
Custom hostnames✓ (for SaaS)✓ (free SSL)
Perma-Cache
Free plan✓ Generous✗ Trial only

Deploy Behind Cloudflare in Minutes

Add your zone, enable proxy, configure caching — done.

Get Started Free Read the Docs