Using GZIP Compression with ColdFusion
As some of you might of heard, Google recently announced they are factoring in site speed as a criteria in their web search ranking. I have about 30 websites being monitored by Google's Web Analytics and over the past month or so I have noticed a significant drop in all their traffic. Now, I'm not 100% sure if this has to do with the new ranking rule or the fact that most US schools are out for summer, but either way this has me a little perplexed and I'm starting to wonder if this has anything to do with my code.
Reading up on a bunch of speed enhancement tips, the one thing I kept coming across is to use HTTP Header Compression. Basically, if the web browser supports it, you can GZIP your Scripts and CSS files and serve them instead of the uncompressed text files. Typically you can save over half the normal file size by doing this. Since I use ColdFusion for most of my sites, I had to find a way to integrate GZIP with ColdFusion. Here's what I came up with.