Early Hints takes advantage of “server think time” to asynchronously send instructions to the browser to begin loading resources while the origin server is compiling the full response. By sending these hints to a browser before the full response is prepared, the browser can figure out how to load the webpage faster for the end user.
Formally, Early Hints is a web standard that defines a new HTTP status code (103 Early Hints) that defines new interactions between a client and server. 103s are served to clients while a 200 OK (or error) response is prepared, which is the “server think time.” You can enable Cloudflare’s edge to cache and send 103 Early Hints responses with Link headers from your HTML pages. The response contains hints about which assets will likely be needed to fully render the web page. This “hinting” speeds up page loads and generally reduces user-perceived latency.
For more information about Early Hints, refer to the Cloudflare and Google Chrome blogs.
Enabling Early Hints
- Log in to your Cloudflare dashboard and select your domain.
- From the dashboard, select Speed > Optimization.
- Under Optimized Delivery, enable Early Hints.
Generating Early Hints
Early Hints are only generated and cached:
- For URIs with
.phpfile extensions, or no file extension
- On 200, 301, or 302 response return codes
- When the response contains link headers with preconnect or preload rel types, such as
Link: </img/preloaded.png>; rel=preload
Emitting Early Hints
Cloudflare will asynchronously look up and emit a cached 103 Early Hints response ahead of a main response.
Currently, only certain browser versions will take action to preload or preconnect on receiving Early Hints, such as Google Chrome M94 and higher. Instructions for running WebPageTest to experiment with compatible client browsers can be found in the blog post.
Additionally, keep the following in mind:
- Early Hints responses may be emitted before reaching the origin server or Worker. When Early Hints is enabled and pages on your site require authentication, unauthenticated visitors may receive a 103 response. The 103 response would contain cached Link headers and be sent before a 403 Forbidden response from your origin.
- Early Hints may be emitted less frequently on requests where the content is cacheable. Cloudflare CDN is more likely to retrieve a response header before the asynchronous Early Hints lookup finishes if the response has been cached. Cloudflare will not send a 103 response if the main response header is already available.
- Cloudflare currently disables Early Hints on some User-Agents, for example, select search crawler bots that show incompatibility with 1xx responses.
- You may see an influx of
504responses with the
earlyHintsCachein Cloudflare Logs when Early Hints is enabled, which is expected and benign. Requests from
earlyHintsCacheare internal subrequests for cached Early Hints, and they are neither end user requests, nor do they go to your origin. Their response status only indicates whether there are cached Early Hints for the request URI (
200on cache hit,
504on cache miss). These requests are already filtered out in other views, such as Cache Analytics. To filter out these requests or to filter requests by end users of your website only, please refer to Filter end users.