Skip to content

Choosing a CDN for WordPress media: BunnyCDN, KeyCDN, R2, CloudFront

The "best" CDN depends on your egress pattern, your team's comfort with infrastructure, and what you need beyond cache. A decision framework that maps usage profiles to vendors.

Marketing wants the site faster on mobile in Brazil. The plan is “put images on a CDN.” Three weeks later you have a Cloudflare account, a BunnyCDN account, a Cloudfront distribution, and a KeyCDN trial — and you still haven’t shipped because every comparison article rates them differently. The decision is rarely about raw speed; speed across the major CDNs is within 30-50ms at the p75. The decision is about how each vendor’s product surface matches your actual workload.

What’s happening

The four contenders cover most of the production WordPress space:

BunnyCDN. Bandwidth-priced, anycast network, opinionated UX. Strong image optimization product (Bunny Optimizer) and edge storage that doubles as a CDN origin (Bunny Storage). Single-vendor stack for image-heavy sites. Account-level API; documentation is sparse compared to AWS but covers the operational basics.

KeyCDN. Bandwidth-priced, pull-zone model, simple control panel. Has been a default choice for WordPress agencies for a decade because the WP Rocket integration is mature and the support team understands WordPress. Image optimization is available but less aggressive than Bunny. Geo restrictions and bot management are basic.

Cloudflare R2 + Cloudflare CDN. Storage and CDN are separate products but integrate cleanly. R2 has zero egress fees — the single most disruptive pricing change in object storage in years for high-egress workloads. Cloudflare’s CDN sits in front; Image Resizing and Polish convert formats on the fly. The Workers platform lets you run custom edge logic, which can be either the killer feature or a foot-gun depending on team appetite.

Amazon CloudFront + S3. The original. Per-request and per-GB billing, granular cache controls, signed URLs, deep integration with the AWS ecosystem. Strong for sites already in AWS — Lambda@Edge runs alongside, IAM controls everything. Standalone, the operational overhead is higher than the alternatives.

The dimensions that actually matter for WordPress media:

  • Egress cost shape. R2’s flat-zero is unique. CloudFront’s per-GB pricing scales with traffic. Bunny and KeyCDN are middle-of-the-road. A site doing 5TB/month of image egress sees order-of-magnitude differences in monthly bill across these.
  • Image transformation. Bunny Optimizer and Cloudflare Polish/Image Resizing convert to WebP/AVIF at the edge. KeyCDN has basic optimization. CloudFront has none natively — you’d add Lambda@Edge or a third-party service.
  • Cache invalidation latency. Bunny purges in seconds. CloudFront invalidations are quick but rate-limited and historically billed when over 1000/month. Cloudflare purges in under a second for single URLs.
  • Origin shielding. Bunny and KeyCDN offer optional shield POPs. CloudFront has Origin Shield ($). Cloudflare’s behavior depends on plan tier.
  • WordPress plugin support. WP Offload Media supports all four. Cloudflare and CloudFront have first-class WP plugins from Automattic/Delicious Brains. Bunny and KeyCDN have community plugins that work but are less polished.
  • Beyond images. If you also need WAF, bot management, DDoS mitigation, Cloudflare and CloudFront dominate. If you need just image delivery, Bunny or KeyCDN suffice.

How to verify

For an existing setup, audit what your CDN actually serves and what it costs you:

# Check which CDN is serving an asset (look at server/cf-ray/x-cache headers)
curl -sI https://example.com/wp-content/uploads/2026/05/photo.jpg | \
  grep -iE 'server|cf-ray|x-cache|x-edge-location|via|age'

# Sample a few URLs to detect cache hit rate
for path in $(curl -sL https://example.com/ | \
                 grep -oE 'https://[^"]+\.(jpg|jpeg|png|webp)' | sort -u | head -20); do
  curl -sI "$path" | grep -iE 'cf-cache-status|x-cache:' | sed "s|^|$path: |"
done

For cost shaping, pull last 30 days of egress from the CDN’s billing endpoint or panel. Compute average GB/day and peak GB/hour. Send the same numbers to two competing vendors’ calculators and compare. Egress concentration matters too: 5TB spread evenly is different from 5TB in two surge days.

For image transformation effectiveness, run a Lighthouse audit before and after activating the CDN’s optimizer. Look at “properly size images” and “serve images in next-gen formats” — both should improve materially after a smart CDN is in place. If they don’t, the optimizer either isn’t active or is misconfigured.

The fix

A decision framework. Pick the row that describes your reality:

Profile A — Image-heavy site, single-vendor preference, moderate technical depth. BunnyCDN + Bunny Storage. Single API surface, image optimization included, predictable pricing. Plugs into WP Offload Media. Best for content/editorial sites, agencies running 10-50 WordPress instances, e-commerce shops with bandwidth concerns. Configuration in wp-config.php:

define('AS3CF_SETTINGS', serialize([
  'provider'             => 'do',         // Bunny uses S3-compatible API; "do" provider works
  'endpoint'             => 'storage.bunnycdn.com',
  'bucket'               => 'acme-media',
  'object-prefix'        => 'wp-content/uploads/',
  'serve-from-s3'        => true,
  'domain'               => 'cloudfront', // custom domain mode
  'cloudfront'           => 'cdn.example.com',
  'force-https'          => true,
]));

Bunny pull zone configuration in their panel: origin URL → your storage zone, edge rules → enable Optimizer with WebP and AVIF on, cache TTL 1 year for /wp-content/uploads/*, query string handling → cache key includes everything.

Profile B — Already deeply on AWS, S3 + IAM + Lambda are familiar. CloudFront + S3. The integration is tight, IAM controls every access edge, signed URLs are first-class. Add Lambda@Edge for WebP/AVIF transformation if you need it (CloudFront doesn’t do this natively). Best for sites whose parent app is already in AWS, regulated workloads needing fine-grained access control, sites that need signed URLs for paywalled content. Higher operational overhead than Bunny.

Profile C — High egress volume, cost is the binding constraint, comfortable with Cloudflare. Cloudflare R2 + Cloudflare CDN. Zero-egress storage with the CDN as the public face. For sites pushing more than ~5TB/month egress, R2 + Cloudflare often comes in materially cheaper than per-GB-priced alternatives — verify against your traffic shape. Image Resizing is solid; Polish handles the format conversion. Workers platform unlocks custom logic at the edge.

// wp-config.php — R2 via WP Offload Media
define('AS3CF_SETTINGS', serialize([
  'provider'             => 'cloudflare',
  'access-key-id'        => getenv('R2_ACCESS_KEY'),
  'secret-access-key'    => getenv('R2_SECRET_KEY'),
  'bucket'               => 'acme-media',
  'region'               => 'auto',
  'endpoint'             => 'https://<account>.r2.cloudflarestorage.com',
  'object-prefix'        => 'wp-content/uploads/',
  'serve-from-s3'        => true,
  'domain'               => 'cloudfront',
  'cloudfront'           => 'cdn.example.com',  // custom domain bound to R2 + CF
]));

Profile D — WordPress-first agency, simple pricing, integrated with WP Rocket / similar. KeyCDN. Pull-zone model is the simplest mental model for teams that don’t want to maintain an origin bucket separately. Documentation is WordPress-aware. Image optimization is basic but adequate for most sites. Best as the “boring choice” for a multi-tenant WordPress shop. Cost predictability is excellent.

Profile E — You need everything: WAF, DDoS, bot management, AND image CDN. Cloudflare end to end. The CDN is one product in a larger security and edge platform. Tradeoff is that Cloudflare’s free/cheap plans rate-limit features the WordPress ecosystem assumes (like cache purge by tag); a paid plan resolves most of it. Image Resizing is a paid add-on; Polish on Pro+ handles format conversion at no extra charge.

A note on combining vendors. It’s tempting to use R2 for storage and BunnyCDN for delivery (zero egress from R2 to Bunny? no — egress to non-Cloudflare destinations IS billed). Verify the egress rules of your storage tier before designing a multi-vendor stack. The savings often disappear at the bill.

Switching cost. Once URLs are baked into rendered HTML, post bodies, and email templates, switching CDNs requires either (a) preserving the custom domain on your side and pointing it at the new CDN — easy if the domain is yours — or (b) a search-and-replace across post content, which is destructive and risks broken HTML in serialized data. Pick once; pick well.


Stack Harbor benchmarks CDN options against actual customer traffic shapes and runs the rollout end to end — including the WP Offload Media wiring, the cache invalidation runbook, and the cost tracking. See Enterprise WordPress for the operating model, or start the conversation if your CDN decision feels stuck.