When Does Read the Docs Serve Stale HTML After a Successful Build?
0 reputation · 30 Dec 2020, 16:35 UTC
0 reputation · 30 Dec 2020, 16:35 UTC
Read the Docs renders HTML from Sphinx sources and stores build artifacts per project version and branch. Rendered pages are then served through a CDN that caches both HTML and static assets. The latest and stable aliases are mutable pointers to the most recent successful build, while versioned URLs such as /en/1.2/ are effectively immutable.
Because an alias changes target on each successful build, a previously cached page for latest can remain valid at an edge after the new build completes. Read the Docs does not expose a user-controlled purge for this layer, so freshness depends on build events, cache TTLs, and the CDN's invalidation behavior. Projects with frequent builds, multiple regions, or heavy reliance on the latest alias may see a wider window in which different users receive different content.
Which mechanism actually governs how long a stale latest page survives at a given edge? Does the versioned URL stay stable while latest lags, and how would that difference be confirmed across networks?
35275 reputation · 31 Dec 2020, 02:29 UTC
The stale HTML is governed by the CDN edge cache's Time-to-Live (TTL) and invalidation behavior for the mutable alias URL—not by the build itself. Read the Docs repoints /latest/ to the new build ID when a build succeeds, but the CDN may continue serving a previously cached copy of that alias path until the cache entry expires or an invalidation reaches the edge.
Confirmed: /latest/ and /stable/ are mutable pointers to the most recent successful build. Versioned URLs such as /en/1.2/ map to a specific build artifact and are effectively immutable. Read the Docs does not expose a user-controlled purge for the CDN layer.
Likely explanation: Because the alias is a single URL whose target changes, the CDN treats it as one cache key. When the target changes, each edge must either wait for TTL expiration or receive an invalidation signal. Propagation delays can cause regional inconsistencies where different networks see different content at the same time. Browser-side caching can extend the perceived staleness beyond the CDN's TTL. Exact TTL values and invalidation timing are not publicly documented by Read the Docs and may change; treat the mechanism as CDN-dependent. This analysis assumes standard Read the Docs hosting; self-hosted or reverse-proxy setups may differ.
To confirm whether the alias is lagging while the versioned URL is fresh, compare response metadata and content across networks:
Age or X-Cache style headers often reveal whether a response was served from cache and how old it is./latest/ differs across regions while /en/<version>/ is identical, the discrepancy is edge-cache propagation.curl -sSI "https://example.readthedocs.io/en/latest/" | grep -iE 'age|x-cache|cache-control'
curl -sSI "https://example.readthedocs.io/en/1.2/" | grep -iE 'age|x-cache|cache-control'
Are you seeing stale content only under /latest/ and /stable/, or do versioned URLs also serve older builds? If only the aliases lag, the issue is alias-cache TTL and propagation. If versioned URLs also lag, the problem is likely upstream of the CDN or local browser caching, and the alias explanation does not apply.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.