Rule from network under performance category
Passmarked is made out of users just like you who helped supply some content. Click below to contribute to this rule. We need you.
The Vary header lets browser clients define how the server identifies each request. This allows the server to control how caching is handled on all it's clients.
The "Accept-Encoding" is a quick way to tell clients and caching servers how to handle requests where GZIP is on and off, treating them as the same or unique.
When "Accept-Encoding" is configured as one of the options in Vary the GZIP and NON-GZIP request would be treated as unique, allowing browsers that do not support GZIP to still access the site.
To fix simply define the header, with at a minimum the "Accept-Encoding" option.
If using Apache (and most probably a shared environment) create/edit the .htaccess
file in the root of the site with the following content:
<IfModule mod_headers.c>
<FilesMatch ".(js|css|xml|gz|html)$">
Header append Vary: Accept-Encoding
</FilesMatch>
</IfModule>
To define the header in your location or server block use the following:
gzip_vary on
Define the setting in web.config:
<system.webServer>
<httpProtocol>
<customHeaders>
<remove name="Vary"></remove>
<add name="Vary" value="Accept-Encoding"></add>
</customHeaders>
</httpProtocol>
</system.webServer>
Passmarked works best when you have an account. It allows you to keep a dashboard with saved data of the sites you have run through the system, we’ll alert you about important updates and you get access to the Passmarked Slack forum.
Sign up to get started