Bypassing CDNs to Avoid Cache Monitoring Issues

Availability monitoring and alerting is a vital part of any organization’s reliability strategy. Monitoring the current and most recent version of a webpage is essential to guarantee that visitors are seeing the most up-to-date content and information, and by the same token, that the monitoring solution is checking the most up-to-date version of a page. This is where browser caching in the context of CDNs (content delivery networks) can occasionally cause monitoring headaches.

Browser caching is a vital part of efficient webpage loading and communications, allowing for local storage of data that promotes faster loading of webpages from the user perspective. However, if the monitored content is behind a CDN, trouble can sometimes arise if the CDN returns outdated cached content. Monitoring a webpage for availability shouldn’t rely on a cached version since updates to the database or code pushes to the frontend could mean that the page’s actual content isn’t being appropriately monitored.

Uptime.com suggests “cachebusting” solutions for bypassing these potential pitfalls, ensuring that the most recent and non-cached version of a webpage is being monitored. We recommend two such solutions for ensuring that the cache is bypassed and probes are accessing the most current state of your website.

Using Cache-Control Headers

For HTTPS checks, use Cache-Control Headers: Set HTTP headers to bypass the cache. You can use headers like Cache-Control: no-cache (which will check the server to see if data has changed before serving the cached data)  or Cache-Control: no-store (which caches no data and may be used when monitoring sensitive data that should not be stored at all).

This instructs the CDN and any intermediary caches to fetch a fresh copy if necessary from the origin server, ensuring that a cached version (or outdated version) is not being fetched for monitoring.

Auto-Rotating Transaction Checker

For Transaction checks, a Random Value of a comma-separated list can be added as a Variable Type which will ensure that a cached version is not accessed within the transaction check.

To use this method, use the Set Variable command as the first step within your Transaction check, selecting the Random Value type. Note in the example below that the Specifier field is a comma-separated list, with 5: appearing at the beginning, indicating that 5 characters will be chosen from the list to be held in the variable.

Given step 2 which navigates to the URL followed by the variable defined in the Specifier field, this auto-rotates or randomizes the URL, which effectively bypasses any cached page.

As an alternative, a random number can be entered in the Specifier field to achieve the same result of setting the variable. For example, entering a number such as 999999 as the Specifier will assign a single random number between 0 and 999999 to the variable, which may be simpler than adding a number to the variable from a list.

Caching can be a vital part of data retention and processing speed when accessing webpages, but CDNs can throw a wrench in the works when they access cached pages. If caching is a concern in your monitoring, consider implementing these solutions or sending a message to support@uptime.com for suggestions about how to best avoid cache-based issues.

Minute-by-minute Uptime checks.
Start your 14-day free trial with no credit card required at Uptime.com.

Get Started

Catch up on the rest of your uptime monitoring news