For dynamic compression of static files, compress-file SAF along with find-compressed SAF is used in Web Server 7.0 Update 4.
When a request is sent to the URI for the first time, the compress-file function creates a compressed file in the specified subdirectory, provided the file size is between min-size and max-size.
If check-age parameter is set to true, the compress-file function checks if the available compressed file version is as recent as the non-compressed file version. If not, it recreates a compressed file.
The find-compressed function checks if the compressed version of the requested file is available. It changes the path and directs to the compressed file under the following conditions:
A compressed version is available.
The compressed file version is as recent as the non-compressed version.
The client supports compression.
The HTTP method is GET or HEAD.
The following table describes parameter for the compress-file filter.
Table 7–74 compress-file Parameter
Parameter |
Description |
---|---|
subdir |
(Optional) A directory name, relative to the directory in which the original non-compressed file is located. To overwrite a pre-compressed, compressed file lying in docroot, set the subdir to period (.). The default value is period (.), that is, current directory. |
check-age |
(Optional) Specifies whether to check if the compressed version is older than the non-compressed version. The values can be true or false. The default value is true. |
vary |
(Optional) The values can be true or false. The default value is true. |
compression-level |
(Optional) Controls the compression level used by the compression library. The 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. |
min-size |
(Optional) The values are from 0 to INT_MAX. The default value is 256. |
max-size |
Optional) The values are from min-size to INT_MAX. The default value is 1048576 |
<Objectname="default"> NameTrans fn="assign-name" from="*.html" name="find-compressed" ... Service method=(GET|HEAD|POST) type=*~magnus-internal/* fn=compress-file subdir=".compressed-files" Service method=(GET|HEAD|POST) type=*~magnus-internal/* fn=send-file ... </Object> <Objectname="find-compressed"> PathCheck fn="find-compressed" </Object>