Cache busting in monitoring

When setting up URL monitors, it's crucial to ensure that your monitoring service always receives the freshest content from your target endpoint, rather than a cached version. This is where cache busting comes into play. Cache busting techniques allow you to bypass intermediate caches and force the server to return a new response for each request.

Using a timestamp placeholder in the URL

A common and effective way to bust caches is by appending a unique, dynamic parameter to your URL. Our URL monitors support a {timestamp} placeholder which automatically inserts the current Unix timestamp into your request URL. This ensures that every check request is unique, prompting caches to fetch the latest content from the origin server.

Example

Instead of monitoring https://example.com/api/data, you can configure your monitor's URL as: https://example.com/api/data?v={timestamp}

Each time the monitor runs, {timestamp} will be replaced with the current time, making the URL unique. E.g., https://example.com/api/data?v=1678886400.

Utilizing HTTP headers

Another method involves sending specific HTTP headers with your request that instruct caching mechanisms not to return a cached response. The effectiveness of this method can vary depending on the caching provider and their configuration.

You can configure custom HTTP headers in your monitors to achieve this. For instance, the Cache-Control: no-cache header explicitly tells all caching mechanisms that they must revalidate the cached response with the origin server before using it.