{"id":18017,"date":"2019-05-19T14:05:32","date_gmt":"2019-05-19T14:05:32","guid":{"rendered":"https:\/\/www.hostinger.com\/tutorials\/?p=18017"},"modified":"2025-05-26T08:29:52","modified_gmt":"2025-05-26T08:29:52","slug":"specify-vary-accept-encoding-header","status":"publish","type":"post","link":"\/tutorials\/specify-vary-accept-encoding-header","title":{"rendered":"What is \u201cspecify a vary: accept-encoding header\u201d warning and how to fix it"},"content":{"rendered":"<p>It&rsquo;s possible that you will run into the &ldquo;Specify a Vary: Accept-Encoding header&rdquo; warning when checking your website performance. But what exactly does this mean? How can you fix this?<\/p><figure class=\"wp-block-image size-large is-resized\"><a href=\"https:\/\/assets.hostinger.com\/content\/tutorials\/pdf\/Build-WordPress-Website-in-9%20Steps.pdf\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" width=\"2048\" height=\"566\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook_-Build-website-in-9-steps_in-text-banner-1.png\/public\" alt=\"\" class=\"wp-image-69276\" style=\"width:840px;height:auto\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook_-Build-website-in-9-steps_in-text-banner-1.png\/w=2048,fit=scale-down 2048w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook_-Build-website-in-9-steps_in-text-banner-1.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook_-Build-website-in-9-steps_in-text-banner-1.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook_-Build-website-in-9-steps_in-text-banner-1.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook_-Build-website-in-9-steps_in-text-banner-1.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 2048px) 100vw, 2048px\" \/><\/a><\/figure><p>In this article, you will learn what the error is and how to resolve the issue.<\/p><h2 class=\"wp-block-heading\" id=\"h-what-is-this-warning\">What is this warning?<\/h2><p>Before we dive into how to fix this issue, let&rsquo;s first understand what the &ldquo;Specify a Vary: Accept-Encoding header&rdquo; warning means and how to check if your site is affected.<\/p><p>You can typically find this error on websites that run on web servers as <a href=\"\/tutorials\/what-is-nginx\">Nginx<\/a> and <a href=\"\/tutorials\/what-is-apache\">Apache<\/a>.<\/p><h3 class=\"wp-block-heading\" id=\"h-what-does-specify-a-vary-accept-encoding-header-actually-mean\">What does &ldquo;Specify a Vary: Accept-Encoding header&rdquo; actually mean?<\/h3><p>An Accept-Encoding header is an HTTP header that must be included on every origin server response. Its main job is to inform the browsers if the client can handle the compressed version of the website.<\/p><p>The warning can appear when you don&rsquo;t use Vary: Accept-Encoding in your header on a server or CDN. This will cause either of them to deliver the uncompressed version of your website to modern browsers.<\/p><p>While not on purpose, this can actually affect your site&rsquo;s performance in front of the clients, though it&rsquo;s not major.<\/p><h3 class=\"wp-block-heading\" id=\"h-where-to-find-the-warning\">Where to find the warning?<\/h3><p>If you want to check whether your website is affected, you can conduct a performance analysis using tools like <a href=\"https:\/\/www.pingdom.com\/\" target=\"_blank\" rel=\"noopener\">Pingdom<\/a> or <a href=\"https:\/\/gtmetrix.com\/\" target=\"_blank\" rel=\"noopener\">GTmetrix<\/a>.<\/p><p>After entering your website&rsquo;s URL, performance analyzers will highlight any errors. But worry not; we&rsquo;ll tell you how to fix the problem easily.<\/p><h2 class=\"wp-block-heading\" id=\"h-fixing-specify-a-vary-accept-encoding-header\">Fixing &ldquo;Specify a Vary: Accept-Encoding header&rdquo;<\/h2><p>This tutorial will require you to insert several lines of code, requiring a bit of technical knowledge. If you&rsquo;re not sure, you might need to call a professional to help you.<\/p><p>Let&rsquo;s check out how to fix the &ldquo;Specify a Vary: Accept-Encoding header&rdquo; warning on the two most popular web servers: <a href=\"\/tutorials\/nginx-vs-apache-what-to-use\/\">Nginx and Apache<\/a>.<\/p><h3 class=\"wp-block-heading\" id=\"h-nginx\">NGINX<\/h3><p>To fix this issue <a href=\"https:\/\/www.nginx.com\/\" target=\"_blank\" rel=\"noopener\">on Nginx<\/a>, you need to navigate to the primary configuration in your VPS via SSH. The location is at <strong>\/etc\/nginx\/nginx.conf<\/strong>.<\/p><p>If you&rsquo;re not sure how to access your VPS, check out our <a href=\"\/tutorials\/how-to-use-putty-ssh\">PuTTY SSH<\/a> tutorial!<\/p><p>Once you find the file, you need to add or modify the line <strong>gzip_vary<\/strong>:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">gzip_vary on<\/pre><p>For this, feel free to use your preferred text editor.<\/p><p>Then, save it and restart the Apache service. Your error should be fixed now.<\/p><h3 class=\"wp-block-heading\" id=\"h-apache\">Apache<\/h3><p>While <span style=\"box-sizing: border-box; margin: 0px; padding: 0px;\">you hav<\/span>e to know how to access your VPS using the SSH command on an Nginx server, resolving the warning&nbsp;on Apache&nbsp;is a bit simpler.<\/p><p>You only need an FTP client like <a href=\"https:\/\/filezilla-project.org\/\" target=\"_blank\" rel=\"noopener\">FileZilla<\/a> to navigate to your website&rsquo;s files. Then, you should find and edit your <strong>.htaccess<\/strong> file.<\/p><p>However, be very careful when editing files through FTP. It is highly recommended that you <a href=\"\/tutorials\/backups\/downloading-website-backup\">perform a file backup<\/a> in case anything goes wrong.<\/p><p>Once you&rsquo;re ready with the <strong>.htaccess<\/strong>, you will have to add or modify this snippet to look exactly like this:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;IfModule mod_headers.c&gt;\n  &lt;FilesMatch \".(js|css|xml|gz|html)$\"&gt;\n    Header append Vary: Accept-Encoding\n  &lt;\/FilesMatch&gt;\n&lt;\/IfModule&gt;\n<\/pre><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>Fixing the &ldquo;Vary: Accept-Encoding header&rdquo; is relatively easy when you follow our instructions correctly, either on an Apache or an Nginx server. However, you will need to be careful and create a backup before making any changes to avoid issues with your site or server.<\/p><p>\n\n\n<div class=\"protip\">\n                    <h4 class=\"title\">Learn More Aout Website Maintenance<\/h4>\n                    <p><a href=\"\/tutorials\/website-maintenance-cost\">Website Maintenance Cost<\/a><br>\n<a href=\"\/tutorials\/hacked-website\">How to Diagnose and Fix a Hacked Website<\/a><br>\n<a href=\"\/tutorials\/how-to-monitor-uptime-and-downtime\">Website Uptime and Downtime<\/a><br>\n<a href=\"\/tutorials\/hotlinking\">How to Clear Browser Cache and History<\/a><br>\n<a href=\"\/tutorials\/website\/how-to-inspect-and-change-style-using-google-chrome\">How to Inspect Element<\/a><br>\n<a href=\"\/tutorials\/cookieless-domain-warning\">How to Use Cookie-Free Domains<\/a><br>\n<a href=\"\/tutorials\/website\/how-to-check-your-website-error-log\">How to Check Your Website&rsquo;s PHP Error Log<\/a><\/p>\n                <\/div>\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It&rsquo;s possible that you will run into the &ldquo;Specify a Vary: Accept-Encoding header&rdquo; warning when checking your website performance. But [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/tutorials\/specify-vary-accept-encoding-header\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":108,"featured_media":19722,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to Fix \u201cSpecify a Vary: Accept-Encoding Header\u201d Warning","rank_math_description":"Specify a Vary: Accept-Encoding Header warning can tell you there is something wrong with your site's performance. Let's learn how to fix it!","rank_math_focus_keyword":"specify a vary accept-encoding header","footnotes":""},"categories":[22628,22630],"tags":[],"class_list":["post-18017","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hosting","category-technical-aspects"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/specify-vary-accept-encoding-header","default":0},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/specify-a-vary-accept-encoding-header","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/tutoriels\/specify-vary-accept-encoding-header","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/specify-vary-accept-encoding-header","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/specify-vary-accept-encoding-header","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/specify-vary-accept-encoding-header","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/specify-a-vary-accept-encoding-header","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/specify-vary-accept-encoding-header","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/specify-vary-accept-encoding-header","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/specify-vary-accept-encoding-header","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/specify-vary-accept-encoding-header","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts\/18017","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/users\/108"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/comments?post=18017"}],"version-history":[{"count":9,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts\/18017\/revisions"}],"predecessor-version":[{"id":128901,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts\/18017\/revisions\/128901"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/media\/19722"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/media?parent=18017"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/categories?post=18017"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/tags?post=18017"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}