How-to 4 min read

How to use the Vary HTTP header and why you need it

The Vary header is used to display the requested content of the page when it is cached. The most relevant use of this header in the presence of several versions of dynamic or static pages under the same URL.

What is the HTTP Vary header used for?

It's not always possible to create a unique address for each page. For example, if there is a mobile and regular version or the page is multilingual. In order to open the requested content to the user, the Vary HTTP header is set. Accordingly, if you do not use it, then the user-agent may choose the wrong option from those stored in the cache.
User-agent is an application in HTTP text string format that sends the server information about the browser, OS type, language version, etc.
It is very important to set this header correctly, otherwise, you will make it worse than before. The caching process is designed to reduce time and resources by itself when transferring data from the browser to the original server through several clipboards. Incorrectly configured HTTP headers can break this sequence.

Often, HTTP Vary is used to detect compressed and uncompressed data when dynamically displaying pages. In this case, accept-encoding is used. If the user's browser is not able to process Gzip-compressed content, information is sent in an uncompressed form. This is necessary to improve the appearance of the pages and the content contained on them.

User-agent helps not only to distinguish content versions but also to quickly recognize information by search bots. So Vary header can be partially considered an SEO optimization tool, but you should not specifically configure it for bot recognition.

The most common problems with Vary HTTP

Google Developers identifies several popular problems associated with the definition of user-agent:
Obsolete user-agents may not be detected correctly. To avoid this, the list of agents must be regularly updated while deleting old versions.
Complex recognition of the type of browser in the user-agent.
Confusion with page versions due to incorrect search words. For example, when defining a mobile version, it is better to use the word mobile than android.


The Vary header helps you to identify the correct version of a page among all available under the same URL. To configure, you must specify the correct value for the header and in time to refresh the list of available agents.

This article is a part of Serpstat's Checklist tool
Checklist at Serpstat" title = "How to use the Vary HTTP header​ and why you need it 16261788326062" />
Checklist is a ready-to-do list that helps to keep reporting of the work progress on a specific project. The tool contains templates with an extensive list of project development parameters where you can also add your own items and plans.
Try Checklist now

Speed up your search marketing growth with Serpstat!

Keyword and backlink opportunities, competitors' online strategy, daily rankings and SEO-related issues.

A pack of tools for reducing your time on SEO tasks.

Get free 7-day trial

Rate the article on a five-point scale

The article has already been rated by 0 people on average out of 5
Found an error? Select it and press Ctrl + Enter to tell us

Share this article with your friends

Are you sure?

Introducing Serpstat

Find out about the main features of the service in a convenient way for you!

Please send a request, and our specialist will offer you education options: a personal demonstration, a trial period, or materials for self-study and increasing expertise — everything for a comfortable start to work with Serpstat.




We are glad of your comment
I agree to Serpstat`s Privacy Policy.

Thank you, we have saved your new mailing settings.

Report a bug

Open support chat
mail pocket flipboard Messenger telegramm