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

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


Please enter your comment!
Please enter your name here



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 can buy...

How to Remove jQuery Migrate in WordPress?

Learn how to remove jQuery Migrate from your WordPress site.

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 WordPress plugin...

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

How to configure WP-Rocket plugin for WordPress site

When it comes to optimizing your website, the role of caching in WordPress can never be underestimated. What exactly is caching all about? We know...


WP Rocket

Get 30% discount on WP Rocket plugin Now!