Why am I getting a cache status 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. This could result in a longer time-to-first byte (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', or 'BYPASS' status is usually caused under three main conditions:
- Browser cookies being set
- Conflicting caching plugins
- Cache-control headers set in a .htaccess file
- Being logged into /wp-admin
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 prevents pages from being cached, for example, WooCommerce sets a PHPSESSID. In many cases this cookie doesn't alter behavior, so disabling the cookie is one way to optimize and configure your site to work best with cache.
We have an option you can use within StackCache to help with this.
- Log in to /wp-admin and head to StackCache which you'll find down the left-hand side.
- By default, Remove PHP Session Cookies Matching Empty PHP Sessions will already be set, but you may wish to try selecting Remove PHP Session Cookies From All Pages.
- Select Save Changes.
Once saved, log out of /wp-admin and try refreshing your site or page you're trying to ensure is cached.
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.
Cache-control headers set in a .htaccess file
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.
Being logged into /wp-admin
When you're logged into /wp-admin we'll always force a cache bypass in the HTTP headers to ensure WordPress admin is never cached. If you're trying to ensure your site is being cached you'll need to logout of /wp-admin first, and then test your site, otherwise, the site will never be cached.