Client hints

Client Hints are a set of HTTP request header fields that a server can proactively request from a client in order to get information about the device, network, user and agent specific preferences. The server can then determine which resources to send based on the client information.

The set of "hint" headers are listed in the topic HTTP Headers and summarized below.

Overview

A server must announce that it supports client hints, using the Accept-CH header to specify the hints that it is interested in receiving. When a client that supports client hints receives the Accept-CH header it can append client hint headers that match the advertised field-values to subsequent requests.

For example, following Accept-CH in a response below, the client could append Width and Downlink headers to all subsequent requests.

Accept-CH: Width, Downlink

Note: Client hints can also be specified in HTML using the <meta> element with the http-equiv attribute.

<meta http-equiv="Accept-CH" content="Width, Viewport-Width, Downlink">

Caching and Client Hints

Client hints that determine which resources are sent in responses should "generally" also be included in the affected response's Vary header. This ensures that a different resource is cached for every different value of the hint header.

Vary: Accept, Width, ECT

You may prefer to omit specifying Vary or use some other strategy for client hint headers where the value changes a lot, as this effectively makes the resource uncachable (a new cache entry is created for every different value). This applies in particular to network client hints like Downlink and RTT. For more information see HTTP Caching > Varying responses.

Hint types

Device client hints

Device client hints allow a server to choose what information is sent based on the device characteristics including available memory and screen properties. Headers include: Device-Memory, DPR, Width, Viewport-Width.

Network client hints

Network client hints allow a server to choose what information is sent based on the user choice and network bandwidth and latency. Headers include: Save-Data, Downlink, ECT, RTT.

See also