This site uses cookies and other tracking technologies to make possible your usage of the website, assist with navigation and your ability to provide feedback, analyse your use of our products and services, assist with our promotional and marketing efforts, and provide better user experience.

By using the website, you agree to our Privacy policy

Accept and continue

Report a bug

Cancel
59
How-to 4 min read August 30, 2019

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:
1
Obsolete user-agents may not be detected correctly. To avoid this, the list of agents must be regularly updated while deleting old versions.
2
Complex recognition of the type of browser in the user-agent.
3
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.

Conclusion

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
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

Learn how to get the most out of Serpstat

Want to get a personal demo, trial period or bunch of successful use cases?

Send a request and our expert will contact you ;)

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

Sign In Free Sign Up

You’ve reached your query limit.

Or email
Forgot password?
Or email
Back To Login

Don’t worry! Just fill in your email and we’ll send over your password.

Are you sure?

Awesome!

To complete your registration you need to enter your phone number

Back

We sent confirmation code to your phone number

Your phone Resend code Queries left

Something went wrong.

Contact our support team
Or confirm the registration using the Telegram bot Follow this link
Please pick the project to work on

Personal demonstration

Serpstat is all about saving time, and we want to save yours! One of our specialists will contact you and discuss options going forward.

These may include a personal demonstration, a trial period, comprehensive training articles & webinar recordings, and custom advice from a Serpstat specialist. It is our goal to make you feel comfortable while using Serpstat.

Name

Email

Phone

We are glad of your comment
Upgrade your plan

Upgrade your plan

Export is not available for your account. Please upgrade to Lite or higher to get access to the tool. Learn more

Sign Up Free

Спасибо, мы с вами свяжемся в ближайшее время

Invite
View Editing

E-mail
Message
Optional
E-mail
Message
Optional

You have run out of limits

You have reached the limit for the number of created projects. You cannot create new projects unless you increase the limits or delete existing projects.

I want more limits