Does Cloudflare Do Prefetching?

Does Cloudflare Do Prefetching?

Yes. Enterprise customers can enable prefetching by turning on 'Prefetch URLs' in the Speed app of the Cloudflare dashboard, and including a list of URLs to prefetch in HTML headers.

What is Prefetching?

Prefetching means that Cloudflare pre-populates the cache with content a visitor is likely to request next. This guarantees a higher cache hit rate and thus a faster experience for the user.

How do I use Cloudflare's prefetching feature?

To use Cloudflare's prefetching feature, you must:

1. Turn on the Prefetch URLs setting under the Speed app in the Cloudflare dashboard.

2. Include a Link HTTP response header pointing to a manifest file with the rel=”prefetch” attribute, see the detailed example below (replace the URL with your manifest file URL).

3. Serve the manifest file with text/plain as the Content-type response header.

Example HTTP response header:
Link: <http://www.example.com/manifest.txt>; rel="prefetch"

Example manifest.txt:
/static/fetch1
//other.example.com/fetch2
http://another.example.com/fetch3

The manifest file should contain URIs, protocol-relative URLs or full URLs, separated by new lines. These files must be on your websites that are on Cloudflare. Note that if you reference HTML pages, only the HTML page itself will be pre-fetched - any sub-requests from that HTML will not be fetched unless they too are defined explicitly in your manifest.

Cloudflare will prefetch the files listed in the manifest file.

What Content Can Be Prefetched?

Cloudflare can prefetch any content that is on your account and behind Cloudflare.

Who is Prefetching Available For?

Prefetching is available for all Enterprise customers. To upgrade to Enterprise, contact the Cloudflare team.

Not finding what you need?

95% of questions can be answered using the search tool. This is the quickest way to get a response.

Powered by Zendesk