The main complaint I have with BunnyCDN (and it’s a big one) is no full page caching.
I used it with Cloudflare APO before moving to Cloudflare Enterprise on Cloudways, then eventually Rocket.net. I wouldn’t call it the fastest CDN, but it still ranks high on cdnperf.com, has a decent sized network, lots of settings, yet is simple to setup using their BunnyCDN plugin.
FlyingCDN (from FlyingPress) also uses BunnyCDN which is cheaper than going through BunnyCDN directly because it includes Bunny Optimizer (for image optimization) and geo-replication for $.03/GB. If you were to buy these through BunnyCDN, it’ll probably cost more.
If you use FlyingCDN, there’s no need to configure these. Otherwise, use this guide and lmk if you have questions. BunnyCDN also has good documentation and an even better support team.
- Can I use BunnyCDN with Cloudflare?
- BunnyCDN vs. FlyingCDN (and other CDNs)
- Create a pull zone in specific regions
- Add pull zone name to BunnyCDN’s plugin
- Add CDN URL to your cache plugin
- Make sure assets are served from BunnyCDN
- Use a custom CDN URL
- Force SSL
- SafeHop
- Caching settings
- Perma-cache
- Security settings
- Traffic manager
- Header settings
- Bunny Optimizer
- Edge rules
- Network limits
1. Can I Use BunnyCDN With Cloudflare?
Even though many people told me not to use 2 CDNs at the same time, I did and had 0 problems. Gijo Varghese (FlyingPress developer) also recommends Cloudflare + BunnyCDN:
Most bandwidth will be offloaded to BunnyCDN, so take that into account when figuring out pricing. If this doesn’t work for you, just use Cloudflare APO since full page caching is essential.
2. BunnyCDN vs. FlyingCDN (And Other CDNs)
3. Create A Pull Zone In Specific Regions
I’ll show you how to set up BunnyCDN and you can learn about features, pricing, and other things along the way. Once you’re signed up, the first step is to create a pull zone.
Create a pull zone under pull zones → add pull zone. Follow the same formatting shown in the screenshot below. Name: onlinemediamasters, origin URL: https://onlinemediamasters.com/
You’ll also select the pricing which is based on regions. Since I don’t have many visitors from South Africa and it was the most expensive region ($0.06 /GB), I disabled it. Just take into account where your visitors are from and how expensive the bandwidth is. You can check your hosting account or Cloudflare to see how much bandwidth your site is using, then use it to get an estimated monthly cost based on your current bandwidth (smaller, optimized sites cost less).
When you’re done, click “Add Pull Zone.”
4. Add Pull Zone Name To BunnyCDN’s Plugin
When you’re done with the first step, you will see this page:
Install the BunnyCDN plugin and add your pull zone name. When you click advanced settings, you can add your API key (found in your account settings) which lets your purge cache directly in the BunnyCDN plugin. Otherwise, you usually shouldn’t need to configure anything else here.
5. Add CDN URL To Your Cache Plugin
In addition to setting up the BunnyCDN plugin, you should also add your CDN URL into your cache plugin’s CDN settings. This can help serve even more assets from the CDN. BunnyCDN’s support recommended this when I noticed several assets weren’t being served, and this fixed it.
6. Make Sure Assets Are Served From BunnyCDN
View your source code and make sure files are being served from BunnyCDN (i.e. images, CSS, JavaScript, fonts). You may need to clear cache, purge the pull zone, or just wait until it updates.
7. Use A Custom CDN URL
Instead of mywebsite.com.b-cdn.net, you can make your hostname cdn.mywebsite.com.
8. Force SSL
In the next few steps, I’ll will walk you through the BunnyCDN settings:
You can start by forcing SSL in the General settings. This makes sure visitors are on a secure connection by redirecting HTTP traffic and prevents duplicate content according to BunnyCDN.
9. SafeHop
If BunnyCDN fails to connect to the origin, you can have it retry which improves reliability.
- Enable SafeHop – set this to ON so a retry will be made.
- Origin Retries – I set this to 1 so only 1 retry will be made
- Retry Delay – I set it to no delay so it will be made immediately.
- Origin Retry Reasons – default connection/response timeout is fine.
- Origin Connect + Response Timeout – I set these both to the maximum amount of time (10s origin connect timeout, 60s origin response timeout) until they’re considered failed.
10. Caching Settings
- Browser Cache Expiration Time – you can either set this to match server cache expiration or override and set to 1 year, since Google suggests 1 year for static assets.
- Query String Sort: ON – two URLs with different query strings will be saved/returned as a single file since they most often have the same result (this prevents duplicating caching).
- Cache Error Responses – prevents DDoS attacks with temporary caching. BunnyCDN says “when enabled, any response with the status code higher than 304 will no longer get cached at all, making sure your content only gets cached when it was supposed to be.”
- Vary Cache – enable browser WebP support. Gijo Varghese from WP Speed Matters says it “tells BunnyCDN to deliver separate files for browsers with or without WebP support.” BunnyCDN also has examples of how the other options can be used, like using a single pull zone for multiple sites or serving different files based on the user’s country/mobile device.
- Strip Response Cookies: ON – strips cookies received from the origin server so clients won’t receive the Set-Cookie response header (disabling this can lead to security risks).
- Optimize For Video Delivery: OFF – only needed if you host videos on your website which can speed up the delivery by breaking videos into chunks so it can build a faster response.
- Stale Cache – I enabled both while origin is offline as well as while updating. While the cache is updating or if the origin is offline, BunnyCDN will temporarily serve a stale cache.
- Follow Redirects: ON – when enabled, it caches 301/302 redirects returned by your origin.
11. Perma-Cache
Perma-cache is also known as geo-replication. When turned on, BunnyCDN automatically copies your files to their storage zones. Files will then be pulled from the closest zone and all future requests to files won’t hit the origin. This improves cache/hit ratio and reduces latency.
Once you enable perma-cache, go to Storage → Add Storage Zone. Give your storage zone a name (your business name is fine), select your main storage region, then click “Enable Geo-Replication.” You’ll be prompted to select the regions where you want your files to be replicated.
The price is $0.010/GB for the first 2 regions (including your main storage region) then $0.005/GB for each additional region. You can just select regions where you have lots of visitors.
When you’re done, click “Add Storage Zone.”
And if you click your storage name (ommstorage), you’ll get a new set of menus where you can use the file manager to upload/access files from your edge storage zone, error handling settings, and the replication tab where you can add more storage zones in case you ever want to expand.
For FlyingPress users, FlyingCDN has BunnyCDN’s geo-replication built in for free.
12. Security Settings
General
These are used to block specific requests, referrers, and IPs from accessing the pull zone. For example, websites hotlinking my images has always been a big problem for me. I set up hotlink protection by adding my site to allowed referrers so only my site has access to the pull zone.
Logging
I have logging enabled for 3 days and anonymize log IPs for better GDPR compliance (you’ll sign the DPS agreement). I didn’t enable log forwarding or permanent storage of logged files.
SSL
Verify origin SSL should usually be turned ON to connect your origin via encrypted HTTPS connection while verifying the certificate on your server (a small tweak to improve security).
502/504 Error Pages
In case users see a 502/504 page, I turned whitelabel error pages ON to remove BunnyCDN’s branding. I haven’t taken the time to create a custom error page, but you would ideally do this.
S3 Authentication
Have BunnyCDN sign requests to the origin URL by adding your AWS information in the fields.
Token Authentication
BunnyCDN has instructions to control who, where and for how long content can be accessed.
13. Traffic Manager
The traffic manager lets you allow, redirect, or block certain countries. You can click certain countries on the built-in map and they will turn white (allow), yellow (redirect), or red (block).
14. Header Settings
- Add CORS Headers: ON – enables CORS headers (cross-origin resource sharing) which is needed when files on your website are being loaded from a third-party domain like a CDN.
- Add Canonical Headers: ON – self-explanatory, canonical headers are good SEO practice.
- Forward Host Headers: OFF – BunnyCDN recommends leaving off (I don’t ask questions).
15. Bunny Optimizer
Bunny Optimizer is great because unlike image optimization plugins, it doesn’t use server resources, take up storage with backups, and resizes images for mobile (which most plugins don’t do). It’s $9.50/mo with unlimited image optimizations. If it’s too expensive, use Optimole.
Imagify | ShortPixel | Optimole | SiteGround CDN | Bunny Optimizer | Cloudflare Mirage/Polish | |
---|---|---|---|---|---|---|
Compression | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
WebP | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Mobile resizing | x | Requires ShortPixel Adaptive Images | ✓ | x | ✓ | ✓ |
Viewport optimizations | x | x | ✓ | x | x | ✓ |
Network optimizations | x | x | ✓ | x | x | ✓ |
AVIF conversion | x | ✓ | ✓ | x | x | ✓ |
AVIF support | x | ✓ | ✓ | x | x | ✓ |
Serve images from CDN | x | Requires ShortPixel Adaptive Images | Cloudfront | SiteGround CDN | ✓ | ✓ |
No server usage | x | x | x | x | ✓ | ✓ |
No bloat | x | x | Offload to cloud | x | ✓ | ✓ |
Price | Free 20MB/mo then $9.99/mo | Free 100 credits/mo then $3.99/mo | Free 5,000 visits/mo then $19.08/mo | Free ($7.49/mo for paid CDN) | $9.5/mo or $.03/GB w/ FlyingCDN | Included w/ Cloudflare Enterprises |
The settings should pretty much all be ON.
- WebP Image Compression – serves WebP images without changing image URLs.
- Dynamic Image Processing – aside from adjusting the width, height, and image quality, this lets you adjust things like sharpen, crop, brightness, and saturation. See how it works.
- Minify CSS Files – minifying CSS from a CDN can often be faster than cache plugins.
- Minify JavaScript Files – minifying JS from a CDN can often be faster than cache plugins.
- Smart Image Optimization – resizes images and adjusts quality for desktop + mobile.
- Watermark Images – add a custom watermark (logo) when BunnyCDN serves images.
- Image Classes – add image classes for dynamic image processing (such as thumbnails).
- Force Transformation Classes – only requests with image classes are used for dynamic processing. They say this prevents token authentication, temporary links, leaked images.
- Statistics – see how much traffic you saved + average compression ratio of your images.
16. Edge Rules
When you click “add edge rule” you can see the available rules and conditions (triggers). BunnyCDN includes a certain amount of free rules then it costs $1/rule. One common rule is to redirect your b-cdn.net hostname to a custom hostname (cdn.mywebsite.com) but there may be other situations where you will block requests, bypass cache over cookies, override cache times, ignore vary cache for query strings (i.e. utm, fbclid), or change token authentication. BunnyCDN also shared some advice to be careful with HTTP/HTTPS schema + trailing slashes.
17. Network Limits
Use network limits to control CDN costs, but I have them left as the default.
What Do You Think?
Have any BunnyCDN tips you think I should add to this post? Did it help you? Let me know your thoughts in the comments – I try to respond to all them, but sometimes it takes me a few days :)
Cheers,
Tom