Find the answers you need

Support Database

Why am I getting a cache MISS?

Headers returning x-cdn-cache-status MISS indicate the request was served by the origin 20i server. This means that the response was not found in the cache and so was fetched from the origin server, resulting in a longer TTFB and a longer total load time. On pages you want to be cached you'd expect to see x-cdn-cache-status HIT.

A cache 'MISS' status is usually caused under three main conditions:

  1. Browser cookies being set
  2. Conflicting caching plugins
  3. Preventative .htaccess file directives

 

Browser cookies

When a cookie is in use on a webpage the CDN edge cache will automatically avoid caching the content. When present, cookies work with the PHP as the page is loaded in order to perform a unique action. When a page is served from cache, it’s already been generated previously by the server. If the page is cached, the cookie cannot be generated and perform its action with the page load as expected.

Some applications also use a PHPSESSID cookie which busts cache as the page will automatically receive a cache MISS, for example, WooCommerce set's a PHPSESSID. In a lot of cases this cookie doesn't alter behaviour, so disabling the cookie is one way to correctly optimise and configure your site to work best with cache. You may wish to try adding  into a php.in file session.use_cookies = 0, if this doesn't work the following code in your .htaccces file should also achieve the same result in disabling the PHPSESSID SetEnv session.use_cookies='0';

Let's take a real-world example. If you have a WordPress website with a shopping cart, you'll almost certainly have a cookie storing data about what product Customer A has in their basket. If this data was cached at a CDN node and served to Customer B, they too would see the same product in their own basket.

Cache Hit Rate: This is the percentage of requests to a site that have been served from cache. Generally, you'll want this to be as a high as possible. Please note, this rate includes traffic from bots as well as genuine website visitors so if you're seeing an unexpected figure you should check if you've scheduled any crawls to your site which may reduce the accuracy of this figure.

 

Conflicting Caching Plugins

Our platform comes with various layers of caching built-in. One of the most effective of these caching layers, especially at scale, is our edge cache system.

Unfortunately, most cache plugins will interfere with this and as a result, we don't recommend running any caching plugins on your WordPress site.

This includes, but is not limited-to: W3TC, Super Cache, WP Rocket and Hummingbird.

Don't panic! You won't need them - all caching plugins are built for speed, and you can rest assured our StackCache plugin will do that hard work for you. 

 

.htaccess File Directives

Cache-Control and Expires headers can be set in the .htaccess file within the root directory for the site. These let you control various elements of how your site is cached, including preventing caching altogether.

If you were to add Cache-Control: no-store into a .htaccess file then the HTTP headers would serve a directive to prevent the site from caching and a cache MISS would be received via the HTTP headers. 

If you receive a cache MISS then you should review your .htaccess file for any conflicting directives.