Print Add to Favorites   Back
HTTP Compression in IIS for CFM

Article Information
Article ID: 3
Author: Greg Hedgepath
Created: 6/24/2008
Modified: 6/24/2008
Views: 6,551

HTTP Compression in IIS

When bandwidth becomes an issue, it is possible to enable HTTP compression between the web server and the browser. This increases CPU load on the web server by a small amount, but can provide fairly massive reductions in page sizes (in the order of 75%).

Compression is part of the HTTP/1.1 specification, which means that most browsers since 1999 support it. In the rare cases where a browser doesn't support the technique, the server will discover this in the initial HTTP handshake and deliver uncompressed pages instead.

To enable HTTP compression for your IIS webserver, changes are made to the IIS server settings. Note that while this will require a restart of IIS, it shouldn't require CF to be restarted.

  1. Open the IIS Manager
  2. Expand the SERVERNAME section
  3. Right click on the Web Sites section and choose Properties from the menu
  4. Go to the Service tab
  5. Check Compress Application Files
  6. Check Compress Static Files
  7. Change Maximum Temporary Folder Size to 100MB (just to be safe)
  8. Hit OK

This has enabled HTTP Compression, but only Microsoft's default file types. We want to add a couple extra static types (CSS and JS) and one very important application type (CFM), which is done through the IIS metabase.

Open a command window Change directory to c:\inetpub\Adminscripts\ Type the following lines (or copy and paste):

cscript.exe adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcFileExtensions "htm""html""txt""css" js"
cscript.exe adsutil.vbs set W3Svc/Filters/Compression/DEFLATE/HcFileExtensions "
htm" "html" "txt" "css" "js"

Next we want to add support for CFM application file types, with these lines

cscript.exe adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcScriptFileExtensions "asp""dll""exe""aspx""cfm"
cscript.exe adsutil.vbs set W3Svc/Filters/Compression/DEFLATE/HcScriptFileExtensions "asp""dll""exe""aspx""cfm"

Finally we apply these changes by restarting the IIS service

IISreset.exe /restart

Close the command window

To check that the changes have been successful, I use the Web Developer addon for Mozilla. The menu option to use is:

Web Developer -> Information -> View Document Size

This will show both the compressed and uncompressed sizes of all the elements on a particular page. Note that you may need to clear your cache to have the browser reload the compressed page elements if the old, uncompressed elements are present.

This URL: