The HTTP User-Agent request header is sent by a client to inform the server which browser and operating system the client is using.
The HTTP User-Agent request header, also commonly referred to as the User-Agent String or UA-String, is used to convey information to servers about the client’s browser and operating system. This information is intended to assist in serving the representation of the resource that is best-suited to the client.
There are three directives including the
version, and a
product is a simple identifier, and the accompanying
version further specifies it. The
comment is used to specify further detail such as sub-product information.
User-Agent: <product> / <version> <comment>
The HTTP User-Agent header may be replaced with Client Hints.
User-Agent strings are normally general enough to avoid identifying specific users. However, at the same time, it is important to consider that web pages are meant to be viewed properly across a large audience and a large number of devices. As such, websites are recommended to avoid over-tweaking content based on the information contained in the User-Agent string.
This example is of a UA-string that has been used by the Google web crawler.
User-Agent: Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
The HTTP User-Agent header is used to provide information about the client’s browser and operating system to the server in order for the server to tailor the HTTP response accordingly.