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.

ALSO READ

Subscribe to our newsletter

To be updated with all the latest news, offers and special announcements.

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

GET STARTED

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

SEMrush

TRY SEMrush for Free!

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 setup CloudFlare CDN for WordPress blog

In today's world website speed is a crucial element to getting good ranks on the web. Website speed also aids for indexing your site...

How to Remove jQuery Migrate in WordPress?

jQuery Migrate greatly simplifies the process of moving older jQuery code to a higher jQuery version by identifying deprecated features. It then restores deprecated...

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,...

How To Reduce Admin-Ajax Server Load In WordPress

To increase better user experience, we always end up by increasing site speed. After clicking a website link seems like a simple thing. But...

WP Super Cache Plugin: Best Settings & Configuration Guide

A cache plugin serves static contents to the visitor which improves page load speed. There are so many cache plugins available in the...