Contact Number


Email Address

Social Icons
Empowering small to large businesses since 2008

Fulfilling all your IT needs at single stop
CIN: U74999PB2016PTC045616​GSTIN: ​​03AACCO3599B1ZO

Specify a vary accept-encoding header

Specify a vary accept-encoding header

Everyone having online presence wants to have fast loading speed of the webpage or the website. The speed is checked by using the tools such as GTmetrix, Pingdom, or Google PageSpeed Insights. These tools summarizes your page performance and provides warnings and recommendations for fast running page. One such warning that appears is "Specify a vary accept-encoding header". This article deals with the ways in which the warning can be fixed. 

Let us first understand the meaning of the "Specify a vary accept-encoding header".

Accept-encoding header is an HTTP header that is crucial to be included on every origin server response. It’s main function is to inform the browser that weather a client can handle the compressed version of the website. 

For instance, let's assume you have an older browser without gzip compression and a modern browser with it. If you are not using Vary: Accept-Encoding header your web-server or CDN could cache the uncompressed version and can send it to modern browser mistakenly. This will in turn affect the performance of your website. Using Vary: Accept-Encoding makes sure that the appropriate version is delivered by your server or CDN. 

Fix "Specify a Vary: Accept-Encoding Header" Warning in Apache

Add the below code to your .htaccess file. 

<IfModule mod_headers.c>

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

    Header append Vary: Accept-Encoding



Fix "Specify a Vary: Accept-Encoding Header" Warning in NGINX

Add the code to the config. File. The files are located in  /etc/nginx/ directory and the primary configuration file is /etc/nginx/nginx.conf.

gzip_vary on


This article illustrated some ways in which you can specify a vary: accept-encoding, which will eventually help speed up your website because it ensures you are using gzip compression.  

Hope you enjoyed this article.

Leave a Reply

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

Follow Us