The http-compression filter compresses outgoing content. If the client does not support compression, or the outgoing content is already compressed, http-compression performs no action.
Unlike the find-compressed SAF, the http-compression filter can compress dynamic content such as the output from SHTML pages, CGI programs, or JSPs. However, for reasons of efficiency, the find-compressed SAF is better for static content such as non-parsed HTML files. For more information, see find-compressed.
The following table describes parameter for the http-compression filter.
Table 4–41 http-compression Parameter
Parameter |
Description |
vary |
Controls whether the filter inserts a Vary: Accept-encoding header. If vary is absent, the default value is yes. yes tells the filter to insert a Vary: Accept-encoding header when it compresses content. no tells the filter to never insert a Vary: Accept-encoding header. |
fragment-size |
Size in bytes of the memory fragment used by the compression library to control how much to compress at a time. The default value is 8096. |
compression-level |
Controls the compression level used by the compression library. Valid values are from 1 to 9. A value of 1 results in the best speed. A value of 9 results in the best compression. The default value is 6. |
window-size |
Controls an internal parameter of the compression library. Valid values are from 9 to 15. Higher values result in better compression at the expense of memory usage. The default value is 15. |
memory-level |
Controls how much memory is used by the compression library. Valid values are from 1 to 9. A value of 1 uses the minimum amount of memory but is slow. A value of 9 uses the maximum amount of memory for optimal speed. The default value is 8. |
Output fn="insert-filter" type="text/*" filter="http-compression" vary="on" compression-level="9" |
In this example, type="text/*" restricts compression to documents that have a MIME type of text/* (for example, text/ascii, text/css, text/html, and so on).
Alternatively, you can specifically exclude browsers that do handle compressed content well by using the Client tag as follows:
<Client match="none"\ browser="*MSIE [1-3]*"\ browser="*MSIE [1-5]*Mac*"\ browser="Mozilla/[1-4]*Nav*"> Output fn="insert-filter" filter="http-compression" type="text/*" </Client> |
This example restricts compression to browsers that are not any of the following:
Internet Explorer for Windows earlier than version 4
Internet Explorer for Macintosh earlier than version 6
Netscape Navigator/Communicator earlier than version 6
Internet Explorer on Windows earlier than version 4 may request compressed data at times, but does not correctly support it. Internet Explorer on Macintosh earlier than version 6 does the same. Netscape Communicator version 4.x requests compression, but only correctly handles compressed HTML. It does not correctly handle linked CSS or JavaScript™ from the compressed HTML, so administrators often simply prevent their servers from sending any compressed content to that browser (or earlier).