Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I enabled gzip/Deflate compression on our servers per Google's Page Speed directives, and it looks like it's now compression html/php files, but a couple file formats aren't being compressed that Google rightfully is saying should be compressed, namely .js and .ttf files. How do I add more file formats to httpd.conf so they're compressed as well?

Current lines in httpd.conf I have are:

# Deflate output configuration
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

Is it as simple as adding text/js and text/ttf?

share|improve this question
up vote 3 down vote accepted

Yep. Just add more types:

AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript application/x-font-ttf
share|improve this answer
Thanks. I added those, restarted apache, and Google still complains that a .js file and .ttf files aren't gZipped. – Keefer Dec 8 '11 at 15:44
If you use Firebug you should be able to see if it is compressed or not. Check that to see if this is working or not. Also, while testing, I would use htaccess for this. Then once you're sure it is working properly update your http.conf file with the final content. It will be faster for you to test that way. – John Conde Dec 8 '11 at 15:46
Where in Firebug will I see if the ttf and js a deflated? – Keefer Dec 8 '11 at 15:54
In the "Net" tab look for a ttf file and click on it. You'll see the headers. If you see "Content-Encoding gzip" it is compressed. – John Conde Dec 8 '11 at 15:57
The .js files are being in fact showing in Firebug as gzipped. Google's analysis is just flawed? I can't check in Firebug the ttf's though, as Firefox loads the .woff font files instead. – Keefer Dec 8 '11 at 16:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.