Accelerated RSC

The https://www.repcoservice.com website is accelerated by Varnish Cache which is a reverse proxy used to make the website really fast. 

It works by intercepting all requests to the website, and responding to them without most of them where possible. If it can't respond to them, it retrieves the webpage from the origin server, and caches it for the next request.

Unfortunately content management systems and cached websites don't really play that nicely. To work around this we've implemented a strategy to achieve the best of both worlds. This page will outline anything you need to be aware of now that RSC is accelerated.

Split-domain strategy

To work around issues with cached websites and FarCry, we've employed a split-domain strategy:

If you need to use FarCry and author content, you should always use https://admin.repcoservice.com. Once all of your changes are published you'll need to check https://www.repcoservice.com to ensure the latest content is being served.

Follow these general steps:

Cache hit or miss?

Web pages on an accelerated website generally work as follows:

  • First request to a page (i.e. /why-choose-us) results in a miss with the content served from the origin.
  • A second request to the same page (i.e. /why-choose-us) results in a hit with the content served from the cache.

In the event of a miss, the cache forwards the request to the origin server (i.e. the Telligence server) to retrieve the content. It then returns this content to the client who made the request (i.e. a human with their browser, GoogleBot) and also puts it in the cache for later requests to the same content.

In the event of a hit, the cache immediately responds to the request, without communicating with the origin server. This makes the website requests really fast.

To determine if a page was a cache hit (i.e. the response came from the cache) or a cache mis (i.e. the response came from the origin) you can install this Chrome extension.

Once the extension is installed, visit a web page. If the icon turns green, it's a cache hit. If the icon turns red, it's a cache miss. If the icon turns blue, it means Varnish cache was used but a cache hit/miss is indeterminable. If the icon remains grey, it means Varnish cache was not used.

Invalidating the cache

When using an accelerated website, the majority of responses to a request for the server, are handled by the cache, without communicating with the origin server. This makes the website requests really fast, however, introduces a consideration in that content in the cache can become outdated.

We need to ensure the cache doesn't become stale and ensure it's always serving the latest version of the content. To ensure this, we've updated FarCry to automatically update content when a content item is published. It works like this:

  • A page in FarCry (on https://admin.repcoservice.com/) is published.
  • A request to the cache is made to invalidate the url that was published.
  • A request for that page is considered by Varnish.
  • Because the url has been invalidated, the cache forwards the request to the origin, returns the content to the client and updates the cache with the new content.
  • Another request for that page comes into the cache and is immediately responded to by the cache, without communicating with the origin server.

Invalidating index pages

The Varnish cache integration will only invalidate the URL for a particular page. It won't attempt to invalidate pages where the update page might be referenced. For example, editing a news page won't also invalidate the news index. Editing a page that lives in the Why Choose Us navigation won't also invalidate the Why Choose Us page (which references the edited page).

As such, you need to be aware when you should manually invalidate a particular URL. For example, if you create a new news article, you should manually invalidate the Latest News index.

Read "Invalidating a particular URL" below to learn how to invalidate a particular page.

Invalidating a particular URL

If you need to invalidate a particular url, you can visit FarCry and go to Admin (tab) > Varnish Cache > Purge Url. Simply the follow the steps to invalidate the cache. Then request that url on the https://www.repcoservice.com/ domain to make sure the new content is returned.