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"
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.
What Content Can Be Prefetched?
Cloudflare will prefetch the files listed in the manifest file only if the resources are normally considered cacheable by Cloudflare. Review documentation on understanding Cloudflare's CDN for details.
Who is Prefetching Available For?
Prefetching is available for all Enterprise customers. To upgrade to Enterprise, contact the Cloudflare team.