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:

<IfModule mod_headers.c>

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

Header append Vary: Accept-Encoding



What Is Xmlrpc.Php in WordPress? Should You Disable It?
What Is Xmlrpc.Php in WordPress? Should You Disable It?

To XML-RPC, or not to XML-RPC: that is the question. At least for those who have an affinity with remote control in WordPress. Indeed, Extensible Mark...

How to Embed A Youtube Video In WordPress?
How to Embed A Youtube Video In WordPress?

Videos are great to grab attention, engage and get more visitors that stay longer on your website. Videos reduce the bounce rate on your WordPress pag...

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

specify a vary accept encoding header error

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.

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.

Frequently Asked Questions

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.

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.

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

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

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.

Diego Manson

Posts: 218

My name is Diego Manson, or as people call me, Seodiego. I'm an SEO enthusiast and blogger. Because of my interest in the internet, I wanted to make it a better place for myself. That's why I'm into SEO. I try to share all I know and learn with everyone to help people improve their online skills.


Send Comment

Your email address will not be published.

(Total: 28 Average: 5 )

No comments to show.