Skip to content

Peakhour's cache and delivery controls help speed up your website by caching and distributing eligible static assets through the Peakhour Edge delivery path. Unlike traditional static asset hosting workflows that require you to upload content to separate servers and serve it from a different domain, Peakhour applies this transparently without requiring changes to the origin website.

Peakhour provides a comprehensive set of features for controlling the caching and storage of content from the origin server. These options allow you to optimise performance, reduce origin requests, and ensure that your website remains fast and responsive for your users.

Cache settings screen with cache control and purge options
Use the dashboard view to confirm how the reference settings map to live cache behavior.

Cache Settings

  • Enable caching: This setting enables delivery caching on your website.
  • Soft purge: This setting determines how Peakhour will handle cache purging. Enabling this feature will default purges to only purge cached content if new content is available on the origin, instead of being purged immediately and fetching regardless if it was changed.

On Request

The On Request phase allows you to control how requests are processed during the request handling phase of content delivery. This section covers the different options available to customise cache behaviour.

This option allows you to specify a series of cookies that your application may set on a client. If these cookies are set, Peakhour will serve fresh content, bypassing the cached asset and fetching it from the origin server. This is useful when serving dynamic content to logged-in users but not to anonymous users.

Query args

The Query args option allows you to remove certain query arguments when considering cached resources. For example, you may want to strip UTM arguments, or gcid's.

Cache Query Handling

Peakhour offers three options for handling assets that have a query string:

  1. Do not cache resources that have a query string. This is the default option and assumes that the asset is dynamically generated based on the parameters specified in the query string.
  2. Cache the asset along with its full query string. If this mode is selected, each permutation of the query string will result in a different cache entry.
  3. Cache the asset and ignore the query string. This option will cache the asset without the query string and serve the stored file, regardless of whether a request is made with different query strings.

Ignore Invalidate

If an asset has been requested and cached without a query string (e.g., /styles.css) and then is requested with a query string (e.g., /styles.css?v=1.1), the default behaviour is to invalidate the cache entry for /styles.css. Ticking the Ignore Invalidate box will prevent this from happening. Alternatively, you can change the query handling mode to cache with the query string.

Ignore Request Cache-Control

The Ignore Request Cache-Control option allows you to ignore requests with cache-control headers. This will prevent clients from forcing the cache to fetch fresh content from the origin server by specifying this header. This is useful to override site crawlers and page speed testers that set this header.

On Response

The On Response phase controls how Peakhour processes responses it sends to a client. This section covers the different options available to customise cache behaviour on response.

Browser TTL

The Browser TTL option allows you to force a specific cache policy for browser caching by setting the cache-control: max-age=XXX in responses.

On Origin Request

The On Origin Request phase controls how Peakhour processes requests to the origin server. Peakhour provides several options to control how it communicates with the origin server, allowing you to optimise caching behaviour and minimise origin requests.

Serve Stale

In the event that the origin server is unavailable, Peakhour can continue serving stale cached resources. This ensures that your website remains available to users even if the origin server is down. The stale content will be served until the origin server becomes available again, at which point the cache will be refreshed with the latest content.

Normalise User-Agent for Vary

Some origin servers return different content based on the user-agent, for example serving a different version of a website for desktop and mobile devices. To optimise caching behaviour, Peakhour can normalise the user-agent to a device type, such as browser or mobile, to help flatten cached responses increasing the cache hit rate.

On Origin Response

Peakhour provides a range of options to control how it stores and caches responses from the origin server. These options allow you to fine-tune caching behaviour and optimise performance.

Implicit TTL

If the origin response does not contain any cache headers, Peakhour can use the implicit TTL value specified in the cache settings to determine the cache time-to-live (TTL) for the cached object. This ensures that cache entries remain fresh and up-to-date without the need for explicit cache headers from the origin server.

Require cache-control for caching

To ensure that only cacheable content is stored in the cache, Peakhour can require the presence of the cache-control header in the origin response. This will prevent non-cacheable content from being stored in the cache, reducing the amount of cache storage required and ensuring that the cache is filled with content that can be served to users.

Strip cookies on store

When storing a response in the cache, Peakhour can strip any Set-Cookies headers sent by the origin. This helps to protect user privacy by preventing the storage of any potentially sensitive information in the cache.

Ignore Vary: User-Agent

If the origin returns a Vary header with the value of User-Agent, Peakhour can ignore this header for caching purposes. This ensures that responses are cached and served to all users regardless of their device type or user-agent.

Edge TTL

Peakhour provides the ability to force the TTL (time-to-live) of cached content, even if the origin returns a lower value. This can be useful for ensuring a minimum cache time for important assets, ensuring that your website remains fast and responsive even during periods of high traffic.

Custom cache tags

If the origin returns a custom header, Peakhour can use this header as a surrogate key in the cache. This allows you to tag cached responses with a key, making it easier to purge specific content from the cache as needed.

Tag separator

If the origin returns multiple cache tags, Peakhour supports separating the tags using a specified separator. This makes it possible to manage multiple tags for a single response, giving you fine-grained control over cache purging.