LTM sorry page image when no pool members available¶
Contributed by: citizen_elah¶
Description¶
Return sorry page with text & images by simply creating an image of
the sorry page to return when no pool members are available to the
virtual
1) Create the image of the sorry page with a screen capture tool 2)
Encode the image at
http://www.motobit.com/util/base64-decoder-encoder.asp 3) Remove
newlines from the string ( in vi, :%s/n//g ) 4) Save string to a file
on LTM: /var/class/sorrypage.class 5) Create a class to reference the
file (see below) 6) Creat a rule to send sorry page when no pool
members are available (see below) 7) Apply rule to virtual 8) Disable
the pool members attached to your vip, then attempt to connect to it,
you should see the sorry page.
iRule Source¶
# Class
b class sorrypage_class extern'{
type string
filename "/var/class/sorrypage.class
}'
# Rule
b rule sorrypage_rule '{
when HTTP_REQUEST {
if {[active_members myPool] == 0} {
HTTP::respond 200 content [b64decode [lindex $::sorrypage_class 0]] "Content-Type" "image/png"
}
}
}'
The BIG-IP API Reference documentation contains community-contributed content. F5 does not monitor or control community code contributions. We make no guarantees or warranties regarding the available code, and it may contain errors, defects, bugs, inaccuracies, or security vulnerabilities. Your access to and use of any code available in the BIG-IP API reference guides is solely at your own risk.