Edge Caching
Edge Caching saves your Kinsta site/page cache (which is only saved to your site’s data center) to any of Cloudflare’s global network of 260+ data centers. When your site visitors load your website in their browser, cached responses will be delivered from the location closest to them, increasing performance and website speed by up to 40%.
Edge Caching is included for free with all Kinsta plans. Unlike some similar caching solutions, there’s no additional cost to you, and Edge Caching doesn’t require a separate plugin.
By default, the cache expires every 24 hours; you can change the expiration time, and you can manually clear the cache. If you manually clear the cache either in MyKinsta, through the WordPress dashboard, or using WP-CLI, it is limited to 1 request every 10 seconds.
Things To Know Before Enabling Edge Caching
- Edge Caching does not currently respect narrow-scope geolocation cache variations (near country borders, state, city). When IP Geolocation is enabled in MyKinsta (WordPress Sites > sitename > Tools > Geolocation), the cache is saved in each PoP location based on the location of the first visitor to request that particular page.
- Advanced Site Cache custom exclusions (such as combinations of custom cookies and URIs) are not respected by Edge Caching.
- You can enable Edge Caching if our Support team has not configured custom cache rules for your site that use custom cookies or geolocation.
Enable Edge Caching
In MyKinsta, you can enable Edge Caching for one or multiple sites, including staging sites, simultaneously from the WordPress Sites page. Select the checkboxes next to the site(s) you want to enable Edge Caching for, click Actions, and choose Change Edge Caching.
![Select which environments you want to enable edge caching for.](https://kinsta.com/_next/image/?url=https%3A%2F%2Fkinsta.com%2Fwp-content%2Fuploads%2F2023%2F11%2Fwordpress-bulk-action-edge-cache.png&w=3840&q=75)
Select Enable and click Change Edge Caching.
![Select to enable edge caching and confirm the change.](https://kinsta.com/_next/image/?url=https%3A%2F%2Fkinsta.com%2Fwp-content%2Fuploads%2F2024%2F05%2Fwordpress-bulk-action-change-edge-confirm-1024x369.png&w=2048&q=75)
Once the process is complete, a success message will appear.
You can also enable Edge Caching for a single site within WordPress Sites > sitename > Caching > Edge Caching > Enable.
![Enable Edge Caching in MyKinsta.](https://kinsta.com/_next/image/?url=https%3A%2F%2Fkinsta.com%2Fwp-content%2Fuploads%2F2023%2F11%2Fwordpress-enable-edge-cache.png&w=3840&q=75)
In the Enable Edge Caching modal/pop-up that appears, read through the list and click the Enable Edge Cache button if all looks well.
![Confirm enabling Edge Caching in MyKinsta.](https://kinsta.com/wp-content/uploads/2023/11/wordpress-enable-edge-caching-confirm-1024x558.png)
If we detect that custom cache rules have been added, a warning will be shown in the Enable Edge Caching modal. If you’re sure those rules will not conflict with Edge Caching, you can proceed by clicking on the Enable Edge Caching button. If you’re not sure, check with a developer to see if your site’s custom caching rules will be compatible with Edge Caching.
Once Edge Caching is enabled, you’ll see the Edge Caching settings.
![Edge Caching settings in MyKinsta.](https://kinsta.com/_next/image/?url=https%3A%2F%2Fkinsta.com%2Fwp-content%2Fuploads%2F2023%2F11%2Fwordpress-edge-caching-settings-1.png&w=3840&q=75)
Enable Mobile Cache
If your website detects mobile browsers and generates pages with markup unique to those devices, you can enable a mobile cache separate from the content for desktop users. If you are unsure about this, please consult with your site developer first.
When Edge Caching is enabled, you can turn on mobile caching in your site’s Edge Caching settings (WordPress Sites > sitename > Caching > Edge Caching). Click the Enable Mobile Cache button to take advantage of Edge Caching for mobile devices.
![Enable Mobile Edge Caching.](https://kinsta.com/_next/image/?url=https%3A%2F%2Fkinsta.com%2Fwp-content%2Fuploads%2F2023%2F11%2Fwordpress-edge-caching-mobile.png&w=3840&q=75)
Clear Edge Cache
There are a couple of ways you can clear your site’s edge cache. Note: If your theme or an active plugin on your site has built-in cache, we recommend clearing the cache there first.
Clear Cache in MyKinsta
In MyKinsta, you can clear the server, CDN, and Edge Cache for one or multiple sites, including staging sites, simultaneously from the WordPress Sites page. This also clears the Redis object cache if you’ve added the Redis addon to your site.
Select the checkboxes next to the site(s) you want to clear the cache for, click Actions, and choose Clear all cache.
![Select which environments you want to clear the cache for.](https://kinsta.com/_next/image/?url=https%3A%2F%2Fkinsta.com%2Fwp-content%2Fuploads%2F2023%2F11%2Fwordpress-bulk-action-clear-cache.png&w=3840&q=75)
Select the types of cache you want to clear and click Clear cache.
![Select the types of cache you want to clear.](https://kinsta.com/_next/image/?url=https%3A%2F%2Fkinsta.com%2Fwp-content%2Fuploads%2F2024%2F03%2Fwordpress-sites-bulk-clear-cache-1024x372.png&w=2048&q=75)
Once the process is complete, a success message will appear.
You can also clear the Edge Cache for a single site within WordPress Sites > sitename > Caching > Edge Caching > Clear cache.
![Clear Edge Cache in MyKinsta.](https://kinsta.com/_next/image/?url=https%3A%2F%2Fkinsta.com%2Fwp-content%2Fuploads%2F2023%2F11%2Fwordpress-edge-caching-clear.png&w=3840&q=75)
If you only need to clear specific URLs or paths, enter the URL in the Clear URL cache field in the format https://mydomain.com/path
and click the Clear URL cache button. To also clear the cache for subdirectories under the URL, check the box next to Clear cache of every subdirectory under the specified URL.
![Clear Edge Cache for specific URLs.](https://kinsta.com/_next/image/?url=https%3A%2F%2Fkinsta.com%2Fwp-content%2Fuploads%2F2023%2F11%2Fwordpress-edge-caching-clear-url.png&w=3840&q=75)
Note: This only clears Edge Caching. If your site cache also needs to be cleared, you’ll need to clear that separately by going to Caching > Server Caching and clicking the Clear cache button.
Clear Cache in Your WordPress Dashboard
If the Kinsta Must Use (MU) plugin is installed, you can clear Edge Caching (and other types of cache) in your WordPress dashboard. Log in to your WordPress dashboard and do one of the following:
- Click the Clear All Caches button on the Kinsta Cache plugin page in your WordPress dashboard.
- Click the Clear Caches link on the WordPress admin toolbar.
Either of these methods will clear both Edge caching and Site cache.
![Clear cache in WordPress with Kinsta MU plugin.](https://kinsta.com/_next/image/?url=https%3A%2F%2Fkinsta.com%2Fwp-content%2Fuploads%2F2023%2F11%2Fwordpress-muplugin-clear-caches.png&w=3840&q=75)
If you would like the cache to be automatically cleared for specific URLs or paths when you make changes on your site, you can configure those in the Kinsta MU plugin Settings. Click Kinsta Cache in the left sidebar and add the URLs you want to purge when updates are made to your site. For more information, check out our guide on Adding Custom Caching URLs in the Kinsta MU plugin.
Clear Cache With WP-CLI
If the Kinsta Must Use (MU) plugin is installed, you can clear Edge Caching (and other types of cache) with WP-CLI.
Connect to your server with SSH and navigate to your site’s document root:
cd public
If the Kinsta Must Use (MU) Plugin is installed on the site, you can clear the full-page cache and the edge cache (when Edge Caching is enabled) with this command:
wp kinsta cache purge
To clear all cache, add the --all
flag:
wp kinsta cache purge --all
Edge Cache Expiration
The cache is set to expire every 24 hours by default, but you can adjust this to be longer if needed. To change the cache expiration:
- Go to MyKinsta > WordPress Sites > sitename > Caching > Server Caching.
Change the cache expiration in the Caching tab in MyKinsta. - Select Change cache expiration, in the modal/pop-up that appears, select your desired cache expiration, and click Change expiration.
Select the cache expiration time.
This changes the server cache and edge cache expiration. For sites that don’t often change, having a longer cache expiration can be beneficial for performance.
Test Edge Caching
Before testing your site with a website speed test tool, we recommend inspecting the HTTP headers of a page to confirm it is loading from the edge cache. Below are a few ways to check your site’s HTTP headers.
Check Edge Caching With Kinsta’s HTTP Status and Redirect Checker
You can check the HTTP status and redirect chain of any URL with our free HTTP status and redirect checker. Using this tool, you can review the response headers to check whether Edge Caching is working.
Choose a page that should be served from the edge cache and copy the URL from your browser’s address bar. Paste this URL into the redirect checker tool and run the check.
You should see results like this:
![Edge Cache headers, ki-cache-type and Ki-CFCache-Status, in HTTP status and redirect checker.](https://kinsta.com/_next/image/?url=https%3A%2F%2Fkinsta.com%2Fwp-content%2Fuploads%2F2023%2F11%2Fwordpress-redirect-checker-edge-caching.png&w=3840&q=75)
Scroll down until you see Response headers. In this section, there are two headers to check the values of: ki-cache-type
and Ki-CF-Cache-Status
. The ki-cache-type
header should have a value of Edge
. The Ki-CF-Cache-Status
header should have a value of HIT
or SAVING
.
Check Edge Caching With a Web Browser
You can use your web browser’s built-in developer tools to check whether Edge Caching is working. For this example, we’ll use Google Chrome to inspect HTTP headers for our site’s homepage. To launch the Chrome developer tools, right-click anywhere on the page and click Inspect.
![Inspect with browser dev tools in Chrome.](https://kinsta.com/_next/image/?url=https%3A%2F%2Fkinsta.com%2Fwp-content%2Fuploads%2F2022%2F07%2Fpasted-image-0-1.png&w=3840&q=75)
Next, click on the Network tab and reload the page. As the page loads, you’ll see a list of the requests on the left-hand side of the developer tools window. Click on the initial page request to verify that Edge Caching is working correctly.
![Edge Cache headers, ki-cache-type and Ki-CFCache-Status, in the Network tab of browser dev tools.](https://kinsta.com/_next/image/?url=https%3A%2F%2Fkinsta.com%2Fwp-content%2Fuploads%2F2023%2F11%2Fwordpress-edge-caching-console.png&w=3840&q=75)
In the Headers tab, scroll down until you see the Response Headers. In this section, there are two headers to check the values of: ki-cache-type
and Ki-CF-Cache-Status
. The ki-cache-type
header should have a value of Edge
. The Ki-CF-Cache-Status
header should have a value of HIT
or SAVING
.
Check Edge Caching in Terminal
If you’re familiar with using Terminal (command line), you can also check HTTP headers with the curl
command. Use the command below and substitute the URL at the end of the command with your site’s URL.
curl -L -s -o /dev/null -D - https://kinstaexample.com
After running this command, you should get a response like this:
![Edge Cache headers, ki-cache-type and Ki-CFCache-Status, in the command line.](https://kinsta.com/_next/image/?url=https%3A%2F%2Fkinsta.com%2Fwp-content%2Fuploads%2F2023%2F11%2Fwordpress-edge-caching-terminal-1024x478.png&w=2048&q=75)
There are two headers to check the values of: ki-cache-type
and Ki-CF-Cache-Status
. The ki-cache-type
header should have a value of Edge
. The Ki-CF-Cache-Status
header should have a value of HIT
or SAVING
.
Troubleshooting Edge Caching
If Edge Caching doesn’t seem to be working, there are a few things you can check for:
- The value of the
X-Kinsta-Cache
header: Edge Caching only caches the response if it was already cached in Site cache (full page caching). If the value ofX-Kinsta-Cache
isn’tHIT
, then the page isn’t cached in Site cache and cannot be cached by Edge Caching. - If you expect the page to be cached and it isn’t one commonly excluded from the cache (e.g. wp-admin, cart, my-account, checkout, etc.), you can check with our Support team to make sure the page doesn’t contain an excluded URL pattern or cookie in the site’s Nginx settings.
Disable Edge Caching
In MyKinsta, you can disable Edge Caching for one or multiple sites, including staging sites, simultaneously from the WordPress Sites page. Select the checkboxes next to the site(s) you want to disable Edge Caching for, click Actions, and choose Change Edge Caching.
![Select which environments you want to disable edge caching for.](https://kinsta.com/_next/image/?url=https%3A%2F%2Fkinsta.com%2Fwp-content%2Fuploads%2F2023%2F11%2Fwordpress-bulk-action-edge-cache.png&w=3840&q=75)
Select Disable and click Change Edge Caching.
![Select to disable edge caching and confirm the change.](https://kinsta.com/_next/image/?url=https%3A%2F%2Fkinsta.com%2Fwp-content%2Fuploads%2F2024%2F05%2Fwordpress-bulk-action-disable-edge-confirm-1024x372.png&w=2048&q=75)
Once the process is complete, a success message will appear.
You can also disable Edge Caching on a single site within WordPress Sites > sitename > Caching > Edge Caching > Disable.
![Disable Edge Caching.](https://kinsta.com/_next/image/?url=https%3A%2F%2Fkinsta.com%2Fwp-content%2Fuploads%2F2023%2F11%2Fwordpress-disable-edge-cache-1.png&w=3840&q=75)
Important Notes
- Edge Caching will be enabled by default in the near future.
- Clearing Edge Cache in all of Cloudflare’s data centers may take 2-5 minutes to fully complete. Once you see the completion notice in MyKinsta, please allow 2-5 minutes for the cache to be cleared in all data centers. If you have a page that needs to be updated more often, our Support team can help you exclude that page from Edge Caching.
- Edge Caching can be enabled on live sites and Premium Staging Environments. It cannot be enabled for Standard Staging Environments.
- Edge caching is incompatible with narrow-scope geolocation cache variations or advanced site cache custom exclusions like combinations of custom cookies and URIs.
- Edge Caching serves your Kinsta site/page cache but does not serve static assets like images, JavaScript files, and CSS files. Kinsta CDN, which is independent of Edge Caching, can be enabled to serve your site’s static assets. If Kinsta CDN is enabled, your site has an additional caching layer managed separately from Edge Caching. The CDN cache can be cleared with the Kinsta MU plugin, with WP-CLI (if the Kinsta MU plugin is installed), or by clearing the CDN cache in MyKinsta.
- We have caching rules in place for Edge Caching to work with standard WordPress, BuddyPress, WooCommerce, and Easy Digital Downloads sites. We exclude common private URIs and cookies, so your WordPress dashboard, forums, cart pages, or anywhere a user is logged in will automatically bypass caching. If you’re using a customized WordPress setup, there may be additional sections of your site that need to bypass cache or additional rules that need to be added for compatibility. If that is the case, you can always contact our Support team.
- Edge Caching will not work for requests that return a
Set-Cookie
Response Header. By default, theSet-Cookie
response header is removed from cached responses in all newly created sites at Kinsta. ASet-Cookie
response header is typically used to provide data intended for a specific client. Caching that response header could show visitors data that isn’t intended for them. - When updating pages in WordPress, there’s no need to manually clear the Site cache or Edge Caching; both will be automatically cleared.
- If you use your own Cloudflare account for your site, you can use Edge Caching if you do not use Cloudflare’s Automatic Platform Optimizations (APO). These two caching methods are incompatible, so you’ll want to use one or the other, not both.
- If you have blocked malicious IP addresses with the IP Deny tool in MyKinsta and do not want those blocked IP addresses to reach even a cached version of your site or be counted in analytics, do not enable Edge Caching. IP addresses blocked with the IP Deny tool are blocked at the Nginx level, not at the Cloudflare level. Since the Cloudflare level doesn’t have the details about IP addresses blocked at the Nginx level, when Edge Caching is enabled, a cached version of your site could be served to a blocked IP address from a Cloudflare data center. If you do not care whether or not a blocked IP address reaches a cached version of your site, you can enable Edge Caching. Note: visits to cached pages are counted in analytics, even if the IP address is blocked at the Nginx level.
- Edge Caching is incompatible with geolocation-based blocking (geo-blocking), such as only allowing certain countries access to your site. Geo-blocking happens at the Nginx level, not at the Cloudflare level. Because Cloudflare doesn’t have your site’s geo-blocking details, when Edge Caching is enabled, a cached version of your site could be served to a blocked location from a Cloudflare data center. If you do not care whether or not a blocked location reaches a cached version of your site, you can enable Edge Caching.
Performance Data
During our beta phase, we gathered performance data from 91 sites to test the speed improvements of our new Edge Caching feature. Here are the results:
- The average HTML load time for a site using our page cache (
X-Kinsta-Cache: HIT
) was 0.4909 seconds. The average load time with Edge Caching was 0.2239 seconds, a 45.6% improvement in speed, or almost cutting load time for HTML in half! - The average TTFB difference was 51% (0.4025 – 0.2069).
Summary
If you want a way to speed up your site, give Edge Caching a try. It makes serving cached content from multiple data centers possible with minimal setup and no additional plugin required.