Table of contents

Purge a page from cache

The www.gov.uk domain is served through Fastly, which honours the cache control headers sent by Varnish. When new content is published, the Cache Clearing Service should take care of purging the page from Varnish and Fastly.

If, for whatever reason, this hasn’t worked properly content already seen by Fastly may be cached for up to an hour (depending on the Varnish cache headers). In this case, you may need to manually purge a page from the two caches.

Purging a page from the cache

Cache Clearing Service provides three Rake tasks which can be used to clear the various caches manually:

Purging a page from Fastly manually (e.g. if GOV.UK Production is dead)

Note

The following command must be run from one of the mirror boxes because we restrict which IP addresses PURGE requests are accepted from.

To purge content on the Fastly cache nodes, use the PURGE method against the URL you wish to purge. For instance:

$ curl -XPURGE https://www.gov.uk/bank-holidays

You should receive ok returned as a response. If not, you may wish to request more verbose output using the -i switch:

$ curl -i -XPURGE https://www.gov.uk/bank-holidays

You can manually flush the cache from the following machines:

  • mirror0.mirror.provider1.$environment.govuk.service.gov.uk
  • mirror1.mirror.provider1.$environment.govuk.service.gov.uk

Full Edge Flush on Fastly

There are two steps involved in flushing everything; our origin (the cache servers) followed by Fastly.

To flush our origin run the following Fabric command:

$ fab $environment class:cache class:draft_cache cache.ban_all

Once this is done move on to Fastly. This can only be done through the Fastly UI - the credentials are in the 2nd line store. If possible, speak to a member of the senior tech team before doing this, to evaluate the risk.

Within the UI you reach the purge all functionality.

  • Click “Configure”
  • Choose the correct service in the service drop down
  • Click on the “Purge” drop down
  • Click on “Purge All”
This page was last reviewed . It needs to be reviewed again by the page owner #govuk-2ndline.