Specifications

rule
BIG-IP® Reference Guide 7-37
rule
Creates, delete, or display the rules on the BIG-IP. Rules allow a virtual
server to access any number of pools on the BIG-IP. Based upon a simple
or complex expressio,n a pool can be selected through a rule. For more
detailed information about using rules, see Rules, on page 4-49.
Note
Before you define a rule, you must define the pool or pools that you want the
rule to reference.
Creatingarule
Rules are generally added to an existing bigip.conf file. Note that the rule
body should not be enclosed with single quotes in the bigip.conf file. For
example:
In this example, if the http_uri string ends with "cgi", then the members of
pool cgi_pool are used. Otherwise, the members of pool another_pool are
used.
b rule <rule_name> ’{ if ( <expression> ) { <if statement> | <use statement> | discard |
<cache statement> | <redirect statement> | <hash statement> <if statement>
} [ { else
<statement>}][{elseif<statement> } ] }’
b rule <rule_name> ’{ discard }’
b rule <rule_name> ’{ use <pool_name> }’
b rule <rule_name> ’{ cache
( <expression> ) { origin_pool <pool_name> cache_pool <pool_name> [
hot_pool <pool_name> ] [ hot_threshold <hit_rate> ] [ cool_threshold <hit_rate> ] [ hit_period
<seconds> ][ content_hash_size <sets_in_content_hash>]}}
b rule <rule_name> ’{ redirect <redirect URL> }’
b rule <rule name> ’{ hash ( variable ) }’
b rule <rule_name> { if '( <statement> ) { use ( <statement> )' } }
b rule <rule_name> { if '( <statement> )' { use '( <statement> )' } else { '(
<statement> )' } }
b rule <rule_name> { if '( <statement> )' { use '( <statement> )' } else { '(
<discard_statement> )' } }
b rule <rule_name> { if '( <statement> )' { use '( <statement> )' } else { '(
<redirect_statement> )' } }
b rule <rule_name> { if '( <statement> )' { use '( <statement> )' } else { '(
<cache_statement> )' } }
b rule <rule_name> delete
b rule <rule_name> show
rule cgi_rule {
if ( http_uri ends_with "cgi" ) { use ( cgi_pool ) }
else { use ( another_pool ) }
}
Figure 7.5 A rule typed into the bigip.conf