HTTP Compression

HTTP Compression

by Constantin Rack

According to RFC 2616, Internet HTTP Compression is a method to send, from the Web server, an HTTP response message in compressed format to a requesting Web browser. This technology assumes that the Web server is capable of encoding the outbound content and the Web browser is capable of (automatically) decoding the received content. HTTP Compression saves transfer data volume and speeds ups Web page load time. This short overview discusses various aspects of HTTP compression, suggest proven solutions, and gives hints to further reading.

Table of Contents

  1. About HTTP Compression
  2. HTTP request flow
    1. Client sends request to server
    2. Servers sends compressed response to client
  3. Compression formats
    1. deflate
    2. gzip
  4. Web server support
    1. Apache Web Server
    2. Microsoft Internet Information Server (IIS)
  5. Web browser support
    1. Microsoft Internet Explorer
    2. Mozilla Firefox
    3. Netscape Navigator
    4. Opera
  6. HTTP Compression Solutions
    1. HTTP Compression Software
    2. HTTP Compression Hardware
  7. Web Resources
    1. Standards
    2. Articles
    3. Software
    4. Hardware
  8. Appendix
    1. About the Author
    2. Copyright


About HTTP Compression

HTTP Compression is a publicy defined way to compress content (mostly textual) transferred from Web servers across the world wide Web to browsers. The impact of compression is that the number of transmitted bytes is reduced and thus a higher performance is gained. HTTP Compression uses public domain compression algorithms to encode HTML, XML, JavaScript, CSS and other file formats at the server-side. This standards-based method of delivering compressed content is built into HTTP/1.1, and all modern Web browsers support the HTTP/1.1 protocol, i.e. they can decode compressed files automatically at the client-side. This means, in particular, that no additional software or user interaction on the client-side is required.

More information on HTTP:
http://www.w3.org/Protocols/


HTTP request flow

Client sends request to server

When a Web browser loads a Web page, it opens a connection to the Web server and sends an HTTP request to the Web server. A typical HTTP request looks like this:

GET /index.html HTTP/1.1
Host: www.http-compression.com
Accept-Encoding: gzip
User-Agent: Firefox/1.0

With this request, the Web browsers asks for the object "/index.html" on host "www.http-compression.com". The browser identifies itself as "Firefox/1.0" and claims that it can understand HTTP responses in gzip format.

Server sends compressed response to client

After parsing and processing the client's request, the Web server may send the HTTP response in compressed format. Then a typical HTTP response looks like this:

HTTP/1.1 200 OK
Server: Apache
Content-Type: text/html
Content-Encoding: gzip
Content-Length: 26395

[GZIP COMPRESSED DATA]

With this response, the Web server tells the browser with status code 200 that he could fulfil the request. In the next line, the Web server identifies itself as Apache. The line "Content-Type" says that it's an HTML document. The response header "Content-Encoding" informs the browser that the following data is compressed with gzip. Finally, the length of the compressed data is stated.


Compression formats

deflate

More information:
www.gzip.org/zlib/

gzip

More information:
www.gzip.org


Web server support

Apache Web Server

In Apache 1.x, there is no native support for HTTP compression. While there exists modules to add this functionality, they are not offical part of Apache and are not stable. In Apache 2.x, there is a module named "mod_deflate" that can compress outgoing data. As this is a relativly simple module that uses standard zlib, it has average performance while lacking flexibility. httpd.apache.org

Microsoft Internet Information Server (IIS)

Starting with IIS 4.0 (Windows NT Server) Microsoft has implemented HTTP compression support in their Web server. Unfortunaly, compression in version 4.0 is very problematic and is not recommended to use. With version 5.0 (Windows 2000 Server), things slightly got better, but again with a lot of problems. The lastest version 6.0 (Windows 2003 Server) has a reliable support for simple HTTP compression, but is hard to configure. If you have an IIS Web Server, I recommend to use an ISAPI filter module like IIS Accelerator.
www.microsoft.com/WindowsServer2003/iis/


Web browser support

Microsoft Internet Explorer

Starting with version 4.0, Microsoft has implemented support for HTTP compression in their Internet Explorer. There have been various bugs with older versions of Internet Explorer, described here and here.
www.microsoft.com/windows/ie/

Mozilla Firefox

Firefox support HTTP compression without problems.
www.mozilla.org/products/firefox/

Netscape Navigator

Starting with version 4.06, Netscape Navigator sends the "Accept-Encoding: gzip" header. This browser has some serious problems concerning HTTP compression that are fixed in version 6.02 and higher.
www.netscape.com

Opera

Starting with version 5.12, Opera understands gzip compressed HTTP responses. There are no serious problems known.
www.opera.com


Web resources

Standards

Books and Articles

Software

Hardware


Appendix

About the Author

Photo of Constantin Rack The author, Constantin Rack, has more than 6 years of experience with HTTP compression. In 2000, he founded VIGOS, a software company specialised on fast, secure and reliable HTTP compression tools. If you have any questions about HTTP Compression, feel free to write him:

VIGOS AG, Attn: Constantin Rack, Steubenstr. 26a, 58097 Hagen, Germany
constantin.rack@vigos.com

Copyright

This Web site and its content is copyrighted 2005 by Constantin Rack. All rights reserved. Last modified: 2005-05-05.