Cloudflare AMP Cache


Cloudflare's AMP Cache serves cached copies of valid AMP content published to the web. Serve content directly from Cloudflare's AMP Cache to provide a fast user experience. Cloudflare's AMP Cache network is distributed worldwide in 102 locations in 50 different countries.

To take advantage of Cloudflare's AMP Cache, an AMP URL must be accessed directly from the cache using the AMP Cache URL format. Each time a user accesses AMP content from the cache, the content is automatically updated, and the updated version is served to the next user once the content has been cached. Publishers can also serve their content from branded AMP Caches using Cloudflare's infrastructure.

To learn more about AMP visit

AMP Cache URL Format

The URL consists of the following components:

Component Description
Content type The content type is one of the following: 'c' for an AMP HTML document, 'i' for an image, or 'r' for a resource such as a font. Cloudflare's AMP Cache returns a 404 error for resources that do not match these content types.
Optional 's' If present, requires that Cloudflare fetch the content from the origin using TLS (secure HTTPS). If the 's' is not present, then content gets fetched from the origin using plain HTTP.
URI URI of the content to be fetched. The URI cannot contain a scheme; that is, no http:// or https://.

Example requesting document using TLS

Request for an AMP page from

looks like:

The 'c' here tells us that the content type is 'AMP HTML document'. If the url looks like:

The extra 's' here will fetch the content from the origin using TLS over plain HTTP.

Example requesting image using plain HTTP

Request for an image fetched from

The 'i' prefix tells us that the content is an image.





In making the above transformations, Cloudflare's AMP Cache disregards the Cache-Control: no-transform header. We also provide a validation API for publishers to see if you AMP content is valid:

Validation API

curl -X POST --data-binary @invalid_amp.html -H 'Content-Type: text/html; charset=UTF-8'
{"version":"1485227592804","source":"POST","valid":false,"errors":[{"line":13,"col":7,"code":"MANDATORY_TAG_MISSING","error":"The mandatory tag 'link rel=canonical' is missing or incorrect.","help":""}]}

AMP Cache Updates

When a user requests an AMP document from the Cloudflare's AMP Cache, the cache automatically requests updates in order to be able to serve fresh content for the next user once the content has been cached. With this model, updates to AMP documents propagate automatically and quickly; few users will see the non-updated version after your update.

The cache follows a "stale-while-revalidate" model. It uses the origin's caching headers, such as Max-Age, as hints in deciding whether a particular document or resource is stale. When a user makes a request for something that is stale, that request causes a new copy to be fetched, so that the next user gets fresh content.

To limit the amount of load it generates for publisher sites, Cloudflare's AMP Cache considers any document fresh for at least 15 seconds, and any resource fresh for at least 1 minute. Note that those numbers may change in the future, as we tune the cache for optimum balance between freshness and load on publisher sites