YSlow gives class F to files compressed with mod_deflate

I use mod_deflate on Apache 2.2 , and the compression level is set to 9. I fine-tuned all possible aspects of the site based on the recommendations of YSlow (v2) , and they managed to get an overall rating of A (Total Score: 91), as well as for all categories, for exception:

  • Make fewer HTTP requests ( Grade C - I'm still working on merging images)
  • Compress components with gzip ( Grade F )

YSlow still reports with F and tells me to use gzip for its CSS and JS files. Here is a screenshot of the YSlow report (the domain was blurred for privacy): screenshot of the YSlow report http://img29.imageshack.us/img29/9160/yslowreportdomainblurre.jpg

However, sites like GIDNetwork GZIP Test report perfect compression!

the mod_deflate section of my .htaccess

# Below uses mod_deflate to compress text files. Never compress binary files. <IfModule mod_deflate.c> SetOutputFilter DEFLATE # compress content with type html, text, js, and css AddOutputFilterByType DEFLATE text/html text/plain text/css text/javascript text/xml image/svg+xml application/javascript application/x-javascript application/atom_xml application/rss+xml application/xml application/xhtml+xml application/x-httpd-php application/x-httpd-fastphp # Properly handle old browsers that do not support compression BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch \bMSIE !no-gzip !gzip-only-text/html # Explicitly exclude binary files from compression just in case 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 SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary SetEnvIfNoCase Request_URI \.avi$ no-gzip dont-vary SetEnvIfNoCase Request_URI \.mov$ no-gzip dont-vary SetEnvIfNoCase Request_URI \.mp3$ no-gzip dont-vary SetEnvIfNoCase Request_URI \.mp4$ no-gzip dont-vary SetEnvIfNoCase Request_URI \.rm$ no-gzip dont-vary # properly handle requests coming from behind proxies Header append Vary User-Agent env=!dont-vary </IfModule> 

Can anyone point out where I'm wrong?

Thank you, t ^ e

+6
gzip compression yslow mod-deflate
source share
3 answers

It is possible that mod_deflate is configured incorrectly.

A typical mod_deflate configuration can be excluded from certain browsers based on user agent strings and can only be configured to compress certain types of files identified by their MIME type registered on the server.

You must compress all your HTML, CSS, and Javascript files, but not PNG, GIF, or JPEG files, and there are bugs with Netscape 4 that you may or may not want to consider. Try using the sample code from the documentation :

 <Location /> # Insert filter SetOutputFilter DEFLATE # Netscape 4.x has some problems... BrowserMatch ^Mozilla/4 gzip-only-text/html # Netscape 4.06-4.08 have some more problems BrowserMatch ^Mozilla/4\.0[678] no-gzip # MSIE masquerades as Netscape, but it is fine BrowserMatch \bMSIE !no-gzip !gzip-only-text/html # Don't compress images SetEnvIfNoCase Request_URI \ \.(?:gif|jpe?g|png)$ no-gzip dont-vary # Make sure proxies don't deliver the wrong content Header append Vary User-Agent env=!dont-vary </Location> 

Please note that you have already published the GIDZipTest GZIP test that does not check the associated Javascript and CSS files, while YSlow is in the GIDZipTest GZIP test, you need to test them individually.

I think it is also possible that your ISP is using a cache proxy server - transparent or not - which distorts or removes the Accept-Encoding: header. To rule this out for a reason, you can force someone to check it from your ISP.

Another thing to note is that when you compress files using gzip, you use bandwidth for CPU time. Above the lower compressive strengths, you reduce the return on bandwidth savings, but it requires a significant increase in processor time. Unfortunately, with a compression force of up to 9, you almost certainly spend too much CPU time on a very slight compression improvement - I would always recommend using force 1.

+4
source share

To do the same with ASP.NET, read this article - http://coder.informisk.com/post/2010/01/10/Get-Grade-A-in-YSlow.aspx

+2
source share

this site http://www.rubyrobot.org/article/5-tips-for-faster-loading-web-sites said AddOutputFilterByType will not work in .htaccess

+1
source share

All Articles