Apache mod_deflate not compressing javascript and css files

apache-2.2deflategziphttpd.confmod-deflate

"GET /Symfony/web/app.php/app/dashboard HTTP/1.1" 4513/37979 (11%)
"GET /Symfony/web/css/application.css HTTP/1.1" -/- (-%)
"GET /Symfony/web/js/application.js HTTP/1.1" -/- (-%)
"GET /Symfony/web/js/highcharts.js HTTP/1.1" -/- (-%)
"GET /Symfony/app/Resources/public/img/logo.png HTTP/1.1" -/- (-%)

Don't know if there is something wrong with my configuration, but the no compression for css and js seems strange to me.

However both css and js are already minified. Here is Apache relevant section in cong/httpd.conf:

# Deflate
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

DeflateCompressionLevel 9

BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# IE5.x and IE6 get no gzip, but allow 7+
BrowserMatch \bMSIE\s7 !no-gzip

Header append Vary User-Agent env=!dont-vary

DeflateFilterNote Input instream
DeflateFilterNote Output outstream
DeflateFilterNote Ratio ratio
LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
CustomLog logs/deflate.log deflate

Best Answer

set your .htaccess too. This is just example:

<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary

#Dealing with proxy servers
<IfModule mod_headers.c>
Header append Vary User-Agent
</IfModule>

</IfModule>