SEMrush
InfoPhilic How to How to Fix Specify a Vary: Accept-Encoding Header Warning

How to Fix Specify a Vary: Accept-Encoding Header Warning

You regularly check your site loading speed. Right? No doubt, it is essential to run a successful blog or site. While checking site loading speed in Pingdom, GTmetrix, or Google PageSpeed Insights, you might have seen a Specify a Vary: Accept-Encoding Header warning. So in this guide, I am sharing a trick to fix this warning.

What is Accept-Encoding Header?

Vary Accept-Encoding header on InfoPhilic
Vary Accept-Encoding header on InfoPhilic

Accept-encoding header is the HTTP header that should be included on every origin server response. It tells the browser whether or not the client can handle compressed versions of the content.

The Accept-Encoding request HTTP header advertises which content encoding, the client is able to understand.

If not utilizing vary: Accept-Encoding header, the CDN may cache and send the uncompressed version to the browser, which indirectly affects the performance of your WordPress site.

But, if utilizing vary: Accept-Encoding header, your web server or CDN will deliver the proper version of your site.

What is the warning about?

Specify a Vary Accept-Encoding header warning in Pingdom speed testing tool
Specify a Vary Accept-Encoding header warning in Pingdom speed testing tool

While checking site speed, if you getting this warning about Accept-Encoding header, that means, you have to fix it for the requests that are from the server.

Although, the header is already applied to your WordPress assets and your original server request. Even many CDNs have introduced it by default. For example, KeyCDN, CloudFlare, and CloudFront all use this.

If you are not using any CDN that I have mentioned above, you might need to fix it by yourself.

To fix this warning, you just need to add some code to your server. Means, you have to do set up according which server you are using.

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

Fixed Specify a Vary Accept-Encoding header warning
Fixed Specify a Vary Accept-Encoding header warning

To fix Accept-Encoding header in Apache, You need to add following code in your .htaccess file.

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

Note: It could break your site if not done in proper way. The better way is to ask your web host first or you may follow these correct ways to Edit .htaccess file.

Fix “Specify a Vary: Accept-Encoding Header” in NGINX:

All NGINX configuration files are located in the /etc/nginx/ directory. Open the primary configuration file /etc/nginx/nginx.conf and add the following code.

gzip_vary on

Wrapping Words:

The another benefit of fixing Accept-Encoding header, it can speed up your WordPress site. It will also improve your website score with website speed test tools such as Pingdom.

I hope you will find this tutorial helpful. You would also like to read How to Auto-Improve Server Response Time.

Amit Malewarhttps://www.infophilic.com/
Amit Malewar has been the tutorial writer since 2013. His passion for helping people in all aspects of technology flow through the expert coverage he provides. In addition to writing for InfoPhilic, Amit loves to read and try new things.

Comment Policy: Your words are your own, so be nice and helpful if you can. Please, only use your real name and limit the amount of links submitted in your comment. We accept clean XHTML in comments, but don't overdo it please.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Join InfoPhilic Community!

Let's build a community (Facebook Group) to help & encourage each other to grow!

POPULAR NOW

Get almost 100% PageSpeed on Newspaper theme

The newspaper theme is the most popular premium theme for a self-hosted WordPress blog. The theme is developed by team tagDiv. You...

How to Remove jQuery Migrate in WordPress?

Learn how to remove jQuery Migrate from your WordPress site.

How to Delete Multiple Images in WordPress Media Gallery

Hey, guys today one of my friends asked me a question, How can I delete Multiple Images in WordPress? I replied, "It's very simple." Yeah,...

Xperia Home Launcher: Install on any Android Device (No Root)

Hey, guys today through this tutorial you are going to learn how to install Xperia Home Launcher on any Android device without any root. Also...

Tips to Speed Up WordPress Performance

Here, I am sharing some tips to speed up WordPress performance. All you need to modify .htaccess file on your server and add some plugins.

GET STARTED

Start your blog or website with Dreamhost

Learn how to start your WordPress blog with Dreamhost hosting. Discover the steps it takes to create a blog in 2020.

Start WordPress Blog: Ultimate Guide For Beginners

Here is our step by step guide for beginners to start a WordPress blog.

Top 6 Best WordPress Theme Frameworks

There are many websites themes which are created by using a framework. Likewise, WordPress Theme frameworks also becoming so popular. The framework allows you...

The Most Essential WordPress Plugins

Here, I have listed some excellent plugins which will surely add more features and new functionality to your WordPress blog.

Tips to Speed Up WordPress Performance

Here, I am sharing some tips to speed up WordPress performance. All you need to modify .htaccess file on your server and add some plugins.

The Ultimate Guide to Harden WordPress Security

Learn how to improve WordPress security. Here are some basic security concepts that will help you to harden WordPress security.

How to Setup CloudFlare Free SSL for WordPress Blog

Google has announced that they will count HTTPS as a ranking factor which means if you using HTTPS you will get a higher position...

DEALS

SEOPressor

SEOPressor plugin gives you maximum SEO clarity on your WordPress sites with features designed for controlling WordPress SEO with ease.

FREE E-BOOK