Set a “Vary: Accept-Encoding” header to woff2 files

I was running speed tests with Pingdom and got the recommendation to set a Vary:Accept-Encoding header on a woff2 file. After a lot of reading and trying different snippets in .htaccess, I finally managed to get it working using this:

AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml x-font/otf x-font/ttf x-font/eot x-font/woff x-font/woff2

<IfModule mod_headers.c>
Header set Vary: "Accept-Encoding"
</IfModule>

Check out this Stack Overflow question for more possible solutions: http://stackoverflow.com/questions/3641197/how-to-specify-vary-accept-encoding-header-in-htaccess

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>