The Accept-Language
request HTTP header indicates the natural language and locale that the client prefers. The server uses content negotiation to select one of the proposals and informs the client of the choice with the Content-Language
response header. Browsers set required values for this header according to their active user interface language. Users rarely change it, and such changes are not recommended because they may lead to fingerprinting.
This header serves as a hint when the server cannot determine the target content language otherwise (for example, use a specific URL that depends on an explicit user decision). The server should never override an explicit user language choice. The content of Accept-Language
is often out of a user's control (when traveling, for instance). A user may also want to visit a page in a language different from the user interface language.
The server possibly can send back a 406
(Not Acceptable) error code when unable to serve content in a matching language. However, such a behavior is rarely implemented for a better user experience, and servers often ignore the Accept-Language
header in such cases.
Header type | Request header |
---|---|
Forbidden header name | no |
CORS-safelisted request header | yes, with the additional restriction that values can only be 0-9 , A-Z , a-z , space or *,-.;= . |