Last updated on February 24, 2019 by J M Mubasshir Rahman

How to Fix “Specify a Vary: Accept-Encoding Header”

Specify a Vary: Accept-Encoding Header

This kind of warning is very common in Speed Optimization. This is actually an HTTP header what is responses from the server to the browser. This warning shows if your server is not Vary header is not configured.

What is Specify a Vary: Accept-Encoding Header

When a browser makes a request, they include HTTP headers for the server to decide what server should response. The Vary header describes what information identifies inside of that HTTP header (what is the request). Caches should only be used if the request matches the Vary information in the cache.

Fix “Specify a Vary: Accept-Encoding Header” Warning

You can only fix the vary headers what is in your server. You cannot fix the 3rd party VARY HEADERS. Fixes of VARY headers depends on the servers. So it differs fixes between Apache and Nginx.

Fixing “Specify a Vary: Accept-Encoding Header” Warning in Apache

If you don’t have root access of your server open your .htaccess and add these following lines of codes:

<IfModule mod_headers.c>
  <FilesMatch ".(js|css|xml|gz|html)$">
    Header append Vary: Accept-Encoding
  </FilesMatch>
</IfModule>

Fixing “Specify a Vary: Accept-Encoding Header” Warning in Nginx

To fix Specify a Vary: Accept-Encoding Header in Nginx you need to open nginx.conf . To open nginx.conf go to /etc/nginx/nginx.conf and add the following line:

gzip_vary on

Specify vary: accept-encoding header

Using the Vary: Accept-Encoding header could decrease the speed of your WordPress site and it will ensure you are using gzip compression.

If you enjoyed this tutorial, then you’ll love our support.  If you need anything relates to WordPress Speed Optimization please send us a message.

Keep Learning