the following configuration in httpd.conf only gzip css and html, not javascript, any idea?
AddOutputFilterByType DEFLATE text/html text/plain text/javascript text/css
AddOutputFilterByType DEFLATE application/x-javascript
apache-2.2gzipmod-deflate
the following configuration in httpd.conf only gzip css and html, not javascript, any idea?
AddOutputFilterByType DEFLATE text/html text/plain text/javascript text/css
AddOutputFilterByType DEFLATE application/x-javascript
Best Answer
That's most likely because the MIME type for Javascript is hotly contested.
Try adding
application/javascript
andtext/x-js
(as well asapplication/x-javascript
)That said, a more reliable way may be to filter based on the
.js
file extension. See theRequest_URI
directive for more info (http://httpd.apache.org/docs/2.0/mod/mod_deflate.html) - this may not work if you're using rewritten URLs that do not use the.js
extension for JavaScript files.If this doesn't work, then your distro of Linux may be using a completely different MIME type for JavaScript. Locate the
TypesConfig
directive in your config file, and have a look to see how it's defining JavaScript. Then add that MIME type in as well.