config : waf file-compress-rule
 
waf file-compress-rule
Use this command to compress specific file types in HTTP replies.
Compression can reduce bandwidth, which can reduce delivery time to end users. Modern browsers automatically decompress files before they display web pages.
You can configure most web servers to compress files when they respond to a request. However, if you do not want to configure each of your web servers separately, or if you want to offload compression for performance reasons, you can configure FortiWeb to do the compression.
By default, the maximum pre-compressed file size is 64 KB. FortiWeb transmits files larger than the maximum without compression. You can use the config system advanced command’s max-cache-size setting to adjust the maximum files size (see “config system advanced”).
To exclude specific URLs from compression, see “config waf exclude-url”.
To apply a compression rule, select it in an inline protection profile. See “config waf web-protection-profile inline-protection”.
To use this command, your administrator account’s access control profile must have either w or rw permission to the wafgrp area. For more information, see “Permissions”.
Syntax
config waf file-compress-rule
edit <rule_name>
config content-types
edit <entry_index>
set content-type <content-type_name>
next
end
[set exclude-url <exclusion-rule_name>]
next
end
Variable
Description
Default
<rule_name>
Type the name of a new or existing rule. The maximum length is 35 characters.
To display the list of existing rules, type:
edit ?
No default.
<entry_index>
Type the index number of the individual entry in the table. The valid range is from 1 to 9,999,999,999,999,999,999.
No default.
content-type <content-type_name>
Type one of the following content types to compress it:
text/plain
text/html
application/xml(or)text/xml
application/soap+xml
application/x-javascript
text/css
application/javascript
text/javascript
To compress multiple file types, add each file type in a separate table entry with its own <entry_index>. See “Example”.
No default.
exclude-url <exclusion-rule_name>
Type the name of an exclusion to use with the rule, if any. See “config waf exclude-url”. The maximum length is 35 characters.
No default.
Example
This example configures a file compression rule that compresses CSS and HTML files, unless they match one of the URLs in the exception named “Compression Exclusion 1”.
config waf file-compress-rule
edit "Web Portal Compression Rule"
config content-types
edit 1
set content-type text/css
next
edit 2
set content-type text/html
next
end
set exclude-url "Compression Exclusion 1"
next
end
Related topics
config waf file-uncompress-rule
config waf exclude-url