
Rules
BIG-IP® Reference Guide 4-57
indicated node address and port. When a rule returns both a pool and a node,
the BIG-IP does not do any additional load balancing or persistence
processing.
Figure 4.30 shows an example of a rule containing a cache statement.
For a complete list of cache statement syntax, see Configuring a remote
origin server, on page 4-64.
Rule-based HTTP redirection
In addition to configuring a rule to select a specific pool, you can also
configure a rule to redirect an HTTP request to a specific location, using the
redirect to operator and a set of format strings included in the BIG-IP. The
location can be either a host name, port number, or URI. The format strings
are: %h, %p, and %u. These format strings can be used within a
redirection string to indicate which parts of the string (host name, port
number, and URI path) do not indicate a redirection.
For example, the string https://%h:443/%u specifies that the HTTP request
is to be redirected to a different protocol (https instead of the standard http)
and a different port number (443). The host name and the URI path remain
the same, indicated by the %h and %u format strings.
Figure 4.31 shows a rule that is configured to redirect an HTTP request.
Figure 4.31 A rule based on HTTP redirection
rule my_rule {
if ( http_host starts_with "dogfood" ) {
cache ( http_uri ends_with "html" or http_uri ends_with "gif" ) {
origin_pool origin_server
cache_pool cache_servers
hot_pool cache_servers
hot_threshold 100
cool_threshold 10
hit_period 60
content_hash_size 1024
}
}
else {
use ( cathost named_servers )
}
}
Figure 4.30 An example of a cache load balancing rule
rule my_rule {
if (http_uri ends_with "baz") {
redirect to "https://%h:8080/%u/"
}
else {
use (web_pool)
}
}
Comentarios a estos manuales