Tuesday, November 08, 2005

HTTP Compression

There is a not-so-well-known configuration in Apache 2.0 called mod_deflate.

The mod_deflate module provides the DEFLATE output filter that allows output from your server to be compressed before being sent to the client over the network.


This actually refers to HTTP compression through gzip, which can speed up data transfer over the internet. Gmail uses this (thats why its fast).


So, how to use this feature?

1. Go to your apache 2.0 config file (httpd.conf)
2. Add this line
AddOutputFilterByType DEFLATE text/html text/plain text/xml
3. save the config file, restart apache and you are done.
4. to see the http header that is now sent, use FireFox (menu->tools->Live HTTP Headers) and look through it (Assuming you have the Live HTTP Headers installed).
5. You should see something like this:
Accept-Encoding: gzip,deflate

No comments: