Within this article we will show you the necessary steps required to create a sorry page (containing an image) that will be published when there are no available pool memebers for the spefic VIP (Virtual Server).
Note : This example is based upon serving a png image.
Table of Contents
Encode Image
First of the image that will used within the sorry page needs to be base64 encoded.
To do this copy the image over to the F5`s directory /var/tmp and name it holding_page.png. The easiest way to copy the file over is by using a scp client (such as Putty`s pscp).
The following command will base encode the image into the file /var/class/image.class.
Note : The following command should be copied to the F5 shell as a single line.
echo \”sorryimage\” \:\= \”`base64 /var/tmp/holding_page.png | xargs echo | sed ‘s/ //g’`\”\, > /var/class/image.class
This should result in a file being created that has the following layout,
[root@f5-ltm:Active] config # head /var/class/image.class
“sorryimage” := “iVBORw0KGgoAAAANSUhEUgAABAAAAAMACAMAAACNZOU/A …… remaining output omitted.
Create Data Group
Next we need to create a Data Group referencing this encoded image. This is done by using the following command,
cat >> bigip.conf
<PASTE THE FOLLOWING>
class sorryimage {
type string
filename “/var/class/image.class”
separator “:=”
}
<CTRL-C>
Create the iRule
We next add the iRule and then load the new configuration.
cat >> bigip.conf
<PASTE THE FOLLOWING>
rule IRULE-SORRYPAGE {
when HTTP_REQUEST {
if { [active_members [LB::server pool]] < 1 }
{ HTTP::respond 200 content [b64decode [class element -value 0 sorryimage ]] “Content-Type” “image/png” }
}
}
<CTRL-C>
b load
Assign iRule
Finally we assign the iRule named ‘IRULE-SORRYPAGE’ to the required Virtual Server.
- How to Configure a BIND Server on Ubuntu - March 15, 2018
- What is a BGP Confederation? - March 6, 2018
- Cisco – What is BGP ORF (Outbound Route Filtering)? - March 5, 2018
Want to become an F5 Loadbalancers expert?
Here is our hand-picked selection of the best courses you can find online:
F5 BIG-IP 101 Certification Exam – Complete Course
F5 BIG-IP 201 Certification Exam – Complete Course
and our recommended certification practice exams:
AlphaPrep Practice Tests - Free Trial