Enabling GZip Encoding On IIS7
Posted By : todd sharp Posted At : June 10, 2009 9:30 AM Posted In: JavaScript, CSS, ColdFusion
6
I've spent a bit of time lately trying to figure out how to enable GZip compression on IIS7. I don't have much experience with GZip, but it doesn't take a rocket scientist to figure out that a smaller file results in a faster page download which always ends in a happier user.
So most of the early advice I found for enabling GZip involved modifying your 'web.config' file. Well, that's all well and good if you're using ASP and actually have a web.config file. Since I'm not using ASP that didn't work out so well for me.
Then I found this post which explained how to use Appcmd.exe to enable dynamic compression. Feel free to read those articles, but here's the quick version:
Step 1: Open a command prompt with elevated permissions.
Step 2: Enter the following command:
Note: This enables dynamic compression at the server level. The following command supposedly enables it at the site level, but that failed in my tests:
I restarted the WWW Publishing service for good measure, cleared my browser cache and hit a few pages with a fair amount of JavaScript/CSS files and checked Fiddler. Sure enough the requests confirmed GZip encoding. A peak in Firebug showed the core jQuery library went from 56KB down to 17KB. My CSS file went from 15KB to just over 4KB. Now those are performance enhancements any developer could love!
I do suggest you do a bit more research to make sure this solution doesn't have any negative side effects for your particular setup. This post seems to go into serious detail on the pros/cons.



Also, be aware that enabling compression on dynamic content will disable cfflush entirely.
And thanks for the heads up on cfflush - I don't use it much, but it's good to let people know.
http://www.aliaspooryorik.com/blog/index.cfm/e/pos...