mod_deflate compressing your Connections pages before they hit the client

I have also posted this over on the Cube Soft Blog
The Apache v2 module mod_deflate is extremely handy if you are serving IBM Connections up to remote locations with little bandwidth. Some of the Connections pages have large css or java script files that are required to function correctly but for countries that have poor connection to the remote server this causes slow page load times and sometimes timeouts.

So mod_deflate to the rescue ..

open your httpd.conf file and ensure that the mod_deflate is uncommented

LoadModule deflate_module modules/mod_deflate.so

just before section 3 for virtual hosts – add the following

## set deflate

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
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won’t work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Don’t compress already-compressed files
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 .(?:avi|mov|mp3|mp4|rm|flv|swf|mp?g)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI .pdf$ no-gzip dont-vary
DeflateCompressionLevel 9

### Section 3: Virtual Hosts

Note – I have the DeflateCompressionLevel set to 9 – this is the highest amount of compression. Depending on the load and size of your HTTP server this may use a lots of CPU time to deflate, this may need to be monitored and tuned for your specific server

Inside the virtual host for the secure Connections server add the same deflate directive (see example below)


ServerName yourservername.com
SSLEnable
Include “/opt/IBM/HTTPServer/conf/rewrite.conf”
Header set Access-Control-Allow-Origin “*”
## set deflate

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
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won’t work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Don’t compress already-compressed files
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 .(?:avi|mov|mp3|mp4|rm|flv|swf|mp?g)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI .pdf$ no-gzip dont-vary
DeflateCompressionLevel 9

restart the HTTP server and the deflate module will be active

You can test the compression by visiting http://www.whatsmyip.org/http_compression/ and enter a url of a Connections page

For instance I put the profiles page of a customer’s server here that mod_deflate is enabled and the compression was a massive 67.4%

Original Size: 7.27 KB
Compressed Size: 2.37 KB
Data Savings: 67.4%

So all in all if you have sites that are in bandwidth starved places – mod_deflate is worth taking a look at.