Skip to main content

Vary Response Header

The Vary Response Header They are used to display the content of the web portal by means of CSS or HTML in a way suitable for the user agent accessing the site. For the user, the use of the http header has the advantage that the content accessed is as optimized as possible for the device. In this way, the use of the Vary Response Header can increase the usability of a page.


As soon as a browser tries to enter a web portal, the http-Header of the respective page provides a response that helps the client to make the page usable for readers. This plays a special role when the user accesses the Internet not only through a desktop computer (as would have been the case a few years ago), but also surfs the web on tablets or smartphones. If the web server recognizes the user, but cannot provide the appropriate content, this often leads to the websites not being able to function properly or not being able to load. The same applies to web spiders. Using the Vary-http header, web crawlers get an indication that the web version is ready to be displayed on mobile devices and desktops.


A Vary Response Header achieves, according to its design, the following functions:

  • It gives the Cache-Servers of the providers the indication that, when requesting the Cache, attention must also be paid to the User Agent.
  • Helps Web Crawlers quickly identify and index mobile-optimized content.
  • Shows that page compression is enabled.


As soon as a client "requests" a server, it receives a response in the http header.

  • User agent should be considerate when displaying content
Vary: User-Agent
  • A complete answer can look like this
GET / page-1 HTTP / 1.1 Host: HTTP / 1.1 200 OK Content-Type: text / html Vary: User-Agent Content-Length: 5710
  • The customer must then know what compression the web portal uses.
HTTP / 1.1 200 OK Vary: Accept-Encoding Content-Encoding: gzip

Uses for Usability

With the Vary Response Header, webmasters can ensure that customers can read their websites correctly. For one thing, users can enter the correct version for their device. On the other hand, search engines have the opportunity to find out if smartphone optimized content is enabled. In this way, the server shows that it is not intended to cover up. They can consider this with indexing, and give the users in the SERPs the appropriate indication. If users use a search engine with a mobile device or desktop, they can rely on the fact that only results that are usable for their device will be displayed.

Web Links