1. Home
  2. >
  3. Solutions
  4. >
  5. Caching

Caching

Cached Components

Deflect handles web pages composed of many elements, including CSS, Javascript, multimedia and large binary files. These file will be cached by Deflect edge to enable speedy access for visitors. However, page components that are hosted on different domains (“widgets”, traffic trackers, etc) are not going to be cached as long as they are served from 3rd-party domain.

Suppose we have a website and it is hosted on a server located in Montreal. The website regularly gets visitors from all over the world. Without cache, when a user from London tries to access that webpage, the request has to travel all the way to the server in Montreal. This back and forth journey takes time, impacting all aspects of site performance.

But once Deflect caches the website’s content on multiple edge servers around the world. This edge server will readily delivers the content to the user upon request. Because of this, Deflect cache can dramatically speed up content delivery since the request and response do not have to travel long geographic distances.

Deflect currently caches responses for 10 min, which can be tuned for individual sites in their Deflect Dashboard.

Cookies

Deflect does not cache requests that contain cookies by default. This means that when Deflect receives a request accompanied by a cookie, that request is not stored in Deflect’s cache. This design is intentional as it protects private user data from being inadvertently stored and contributes to the overall security that Deflect provides.

However, Deflect offers several configuration options for users who require more specific functionalities. One such feature is the ability to specify particular cookie names for caching. This feature is accessed via the Deflect Dashboard.

Is it working?

You can tell Deflect is serving a page by looking at the HTTP headers (using ‘Inspect Element’ on Chrome or Firefox); you’ll see a X-Deflect-Cache header that returns the state of Deflect cache. It will look similar to:

X-Deflect-Cache: HIT

Here are the possible values along with their meanings:

  • HIT: The requested content was found in the cache and served directly without contacting the upstream server.
  • MISS: The requested content was not found in the cache, so it was fetched from the upstream server.
  • BYPASS: The cache was bypassed, meaning the request was sent directly to the upstream server regardless of cache settings.
  • EXPIRED: The cached content has expired, and a request to the upstream server was made to refresh it.
  • STALE: The cached content is stale, but it was served from cache while a revalidation request was made to the upstream server in the background.
  • UPDATING: The cached content is being updated with a request to the upstream server, but an old version is still being served.
  • REVALIDATED: The cached content was validated with the upstream server and is still fresh, so it was served from cache.