Object Caching
Setting up Object Caching with W3 Total Cache and Bunny CDN allows you to quickly serve static assets, like media, CSS, and JS files, to your users across the globe.
Create/Select your Pull Zone
The pull zone set up here will be associated with your website domain and it used as the source for serving static assets to your website visitors.
- Log into your Bunny dashboard and navigate to Delivery > CDN.
- Click + Add Pull Zone to create a new Pull Zone for Object Caching if you do not already have one you want to reuse.
- You can use any name you wish for the Pull Zone Name field, but make sure to use your website’s domain in the Origin URL one.
- Click Add Pull Zone when finished.
Configure W3 Total Cache
These next steps will show you how to use W3 Total Cache as a link between your Bunny CDN Pull Zone and your actual website.
- Log into your website and install/activate the W3 Total Cache plugin.
- Navigate to Performance > General Settings and scroll down to the CDN section.
- Click on the CDN checkbox to enable it and select Generic Mirror from the CDN Type dropdown.
- Next, go to Performance > CDN in your WordPress admin.
- Locate the Configuration section.
- Enter the name of the Pull Zone you created earlier into the Replace site’s hostname with: field.
- Save Settings and Purge all Caches.
Full Site Delivery
Full Site Delivery is a CDN configuration for content delivery that goes beyond caching static files; it also handles complete web pages. With this setup, the CDN functions as a proxy server, fetching entire web pages from the origin server, caching them, and subsequently delivering them to end users in their entirety.
Create/Select your Zones
The first thing that we need to do is set up the Pull and Storage Zones in the Bunny Dashboard. The Pull Zone is where you can manage all of the Caching settings associated with the CDN and the Storage zone is used to house copies of your website files on Bunny’s servers to help reduce delivery times.
- Log into your Bunny dashboard and navigate to Delivery > CDN.
- Click + Add Pull Zone to create a new Pull Zone for Full Site Delivery if you do not already have one you want to reuse.
- Go to Delivery > Storage.
- Click + Add Storage Zone to create a new Storage Zone for Full Site Delivery if you do not already have one you want to reuse.
Configure Caching Settings
Bunny offers a variety of configuration options that can be utilized to create a Full Site Delivery environment that will improve response times and performance for your website.
Disable Smart Cache
Smart Cache is a system developed by Bunny that dynamically selects if a request should be cached based on the file extension and MIME type to allow easy full-site acceleration. However this feature does exclude HTML MIME types from getting cached on the network, so it needs to be disabled to provide a true Full Site Delivery experience for end users.
- Navigate to Delivery > CDN.
- Select your Pull Zone.
- Go to Caching > General.
- Disable Smart Cache.
Set Expiration Rules
The Cache Expiration Time and Browser Cache Expiration Time settings can be configured to allow you to manage/purge cached items from your website using the tools provided by W3 Total Cache in the WordPress admin.
- Go to Caching > General in your Pull Zone settings.
- Change Cache Expiration Time to Respect Origin Cache-Control.
- Set Browser Cache Expiration Time to Match Server Cache Expiration.
Activate Perma-Cache
Perma-Cache is a persistent object storage system that keeps copies of your website files on Bunny’s content delivery network which reduces the delivery time of website assets to end users.
- Open your Pull Zone settings.
- Go to Caching > Perma-Cache.
- Select the Storage Zone you created earlier with the dropdown and Save Configuration.
Make the Edge Rules
Serving static HTML pages from a CDN is a great way to deliver content to your users quickly, but there can be some issues that arise once dynamic WordPress login sessions enter the mix. Fortunately Bunny provides the ability to create custom Edge Rules that allow you to keep serving static HTML pages and keep your login sessions working correctly.
- Open your Pull Zone settings and navigate to Edge Rules.
Override Cache Time
- Click +Add Edge Rule
- Select Override Cache time from the Action dropdown.
- Enter 0 into the Cache time in seconds field.
- Add a Request URL > Match Any condition with the following triggers:
- */wp-admin*
- */wp-login*
- + Add another condition to the rule and select Request Header.
- Enter Cookie into the Header Name field.
- Match any of the following properties for the condition:
- *wordpress_logged_in_*
- *wordpress_sec_*
Override Browser Cache Time
- Click +Add Edge Rule
- Select Override Browser Cache time from the Action dropdown.
- Enter 0 into the Cache time in seconds field.
- Add a Request URL > Match Any condition with the following triggers:
- */wp-admin*
- */wp-login*
- + Add another condition to the rule and select Request Header.
- Enter Cookie into the Header Name field.
- Match any of the following properties for the condition:
- *wordpress_logged_in_*
- *wordpress_sec_*
Bypass Perma-Cache
- Click +Add Edge Rule
- Select Bypass Perma-Cache from the Action dropdown.
- Add a Request URL > Match Any condition with the following triggers:
- */wp-admin*
- */wp-login*
- + Add another condition to the rule and select Request Header.
- Enter Cookie into the Header Name field.
- Match any of the following properties for the condition:
- *wordpress_logged_in_*
- *wordpress_sec_*
Update Nameserver Records
The last step for completing the Full Site Delivery setup is to update the Nameserver records associated with your domain name at the registrar and enable CDN Proxy for your domain in the Bunny’s DNS.
- Go to DNS > DNS Records and enable CDN Proxy for the domain.
- Locate the Nameserver records under DNS > Nameservers.
- Update the Registrar NS records using those nameservers.
W3 Total Cache
You haven't seen fast until you've tried PRO
Full Site CDN + Additional Caching Options
Advanced Caching Statistics, Purge Logs and More
Everything you need to scale your WordPress Website and improve your PageSpeed.