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.

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.

Enable Edge Caching

To enable edge caching, log in to MyKinsta and go to WordPress Sites > sitename > Edge Caching.

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.

Click the Enable button.

Enable Edge Caching in MyKinsta.
Enable Edge Caching in MyKinsta.

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.
Confirm enabling Edge Caching in MyKinsta.

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.
Edge Caching settings in MyKinsta.

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 > Edge Caching). Click the Enable Mobile Cache button to take advantage of Edge Caching for mobile devices.

Enable Mobile Edge Caching.
Enable Mobile Edge Caching.

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 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.
Clear cache in WordPress with Kinsta MU plugin.

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 in MyKinsta

Log in to MyKinsta and go to WordPress Sites > sitename > Edge Caching.

Click the Clear cache button to clear all cache.

Clear Edge Cache in MyKinsta.
Clear Edge Cache in MyKinsta.

If you only need to clear specific URLs or paths, enter the URL in the Clear URL cache field and click the Clear URL cache button. To also clear 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.
Clear Edge Cache for specific URLs.

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 Tools > Site cache and clicking the Clear cache button.

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

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:

Kinsta Edge Cache headers, ki-cache-type and Ki-CFCache-Status, in HTTP status and redirect checker.
Edge Cache headers, ki-cache-type and Ki-CFCache-Status, in HTTP status and redirect checker.

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.
Inspect with browser dev tools in Chrome.

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.

Kinsta Edge Cache headers, ki-cache-type and Ki-CFCache-Status, in the Network tab of browser dev tools.
Edge Cache headers, ki-cache-type and Ki-CFCache-Status, in the Network tab of browser dev tools.

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:

Kinsta Edge Cache headers, ki-cache-type and Ki-CFCache-Status, in the command line.
Edge Cache headers, ki-cache-type and Ki-CFCache-Status, in the command line.

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 of X-Kinsta-Cache isn’t HIT, 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

After enabling Edge Caching, a green check mark is shown beside Enabled near the top of the page. To the right of this section, you can click the Disable button to disable Edge Caching.

Disable Edge Caching.
Disable Edge Caching.

Important Notes

  1. Edge Caching will be enabled by default in the near future.
  2. 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.
  3. Edge Caching can be enabled on live sites and Premium Staging Environments. It cannot be enabled for Standard Staging Environments.
  4. Edge caching is incompatible with narrow-scope geolocation cache variations or advanced site cache custom exclusions like combinations of custom cookies and URIs.
  5. 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.
  6. 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.
  7. Edge Caching will not work for requests that return a Set-Cookie Response Header. By default, the Set-Cookie response header is removed from cached responses in all newly created sites at Kinsta. A Set-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.
  8. Edge Cache is set to expire every 30 days but could be shorter if the edge cache isn’t accessed for some time.
  9. When updating pages in WordPress, there’s no need to manually clear the Site cache or Edge Caching; both will be automatically cleared.
  10. 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.
  11. 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.
  12. 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.

Was this article helpful?