Specify a Vary Accept-Encoding Header Error

Specify a Vary Accept-Encoding Header Error

The ‘Specify a vary: accept-encoding header’ warning is commonly found on WordPress sites. It means that there is a chance your web server could cache the uncompressed version of your sites to users of older browsers. If this occurs, then the performance of your site will suffer.

Time needed: 30 minutes.

In this article, you will discover how to fix this error code.

  1. Ensure your site has a good CDN.

    Many of the CDN plugins available for WordPress use vary:accept-encoding, Cloudflare is one example.

  2. Contact your web host.

    If the previous step didn’t solve your warning, then you should contact your web host. Getting the web host to look into your code saves you from doing it yourself and potentially breaking your site. The code that needs changing is included below.

fix the warning with new code

How to Fix the Warning With New Code

If your web server is NGINX, then you need to navigate to the primary configuration via SSH in your VPS. The location will be /etc/nginx/nginx.conf. Once you have found the file, modify or add the line gzip_vary to show ‘gzip-vary on’. You can use any text editor to change this line of code, then save it and restart the webserver service. The warning should now be fixed.

If your web server is Apache, then you have a bit more luck than those using NGINX because the issue is easier to solve on Apache servers. Use any trustable FTP client such as FileZilla to find and then begin editing your .htaccess file. You then need to find the <IfModule mod_headers.c> line and edit it to look like this:

You can also like this post: The Best WordPress Hosting Options

<IfModule mod_headers.c>

<FilesMatch “.(js|css|xml|gz|html)$”>

Header append Vary: Accept-Encoding



Then save your file and restart the webserver service to clear the warning message.

specify a vary accept encoding header error

FAQs Related to the Error

What is a vary: accept-encoding header?

It allows different versions of the web page to be cached and then send the requested version to the user’s browser. Some browsers don’t support certain types of encoding, so using vary: accept-encoding, you can make allowance and keep your site’s performance high.

How do I turn off Accept-encoding?

You can change the HTTP header code not to allow accept-encoding. However, accept-encoding can increase your site’s performance and make it accessible in the type of compression best suited to each browser that requests to view it.

What is the HTTP origin header?

The HTTP Origin header indicates where requests originate from but doesn’t disclose the entire path.

Why is an accept-encoding header needed?

An accept-encoding header is needed to display the most efficient version of your site to the browsers that request access.

What is the content-encoding representation header?

The content-encoding representation header lists any encodings that have been applied to the message payload. It is used to compress the message’s data while avoiding losses of information pertaining to the origin media type.

Fixing the Error in Short

To conclude, the Specify a vary: accept-encoding header is a warning that occurs on HTML websites. It indicates an issue with providing users with the correct version of the web page they wish to view. If the wrong compressed file is sent to the user, it could result in longer load times and more unsatisfactory overall performance. By using a functioning vary: accept-encoding header, your site increases its performance, and the loading times for users are shortened. Keeping site visitors happy with speedy loading times and good site performance is at the front of every website owner’s mind. Hopefully, you have enjoyed reading this article and have solved your warning of ‘specify a vary: accept-encoding header’, and your site is now running more efficiently.

You can also like this post: What Is a Permalink?

Thank you for reading. If you liked this article, be sure to check out our other articles. You may also like our article about how to edit HTML in WordPress.

We think that you may also be interested in which is our previous post about Computer Support.
Click to rate this post!
[Total: 28 Average: 5]

Posts: 110

As an integrated marketing communications expert, Diego has a lot to share with his readers. He has experience working in the communications and marketing departments of several companies, and now he is sharing what he knows about the business.

No comments to show.

Your email address will not be published. Required fields are marked *