It's not an uncommon problem trying to figure out where to plant that sorry page in the event your farm is down.  It's also not an uncommon solution to just use your BIG-IP to issue a text-only HTTP::respond.  It works, but it's not, how do you say, visually appealing?  You want to say sorry and mean it.  With pictures.  If you take a stroll through the iRules codeshare, you'll notice several solutions to this problem.  All of them work, with a variety of msorryethods, but user kirkbauer's entry takes it to another level.  Kirk's sorry page irule generator (written in perl) takes all the guess work out of the process for you.  Dump the perl script in /var/tmp, give execute permissions to root, and off you go.  Here's a sample configuration, just taking Google's main page:

[root@ltm01:Active] mibs # /var/tmp/sorrygen.pl

Welcome to the F5 Sorry Page iRule Generator

This script will create a sorry page iRule based on an arbitrary web page.

This script can download the sorry page from the specified URL (you may need to use an IP address instead of a hostname if you don't have DNS set up) or it can convert a page (and all includes) already in a local directory.

Enter the prefix pathname (such as 'sorrypage') for a directory that doesn't exist in your app (do not include any slashes):
sorrypage

Please provide the URL (starting with http://) or local directory with the sorry page:
http://www.google.com
Downloading http://www.google.com/
Downloading http://www.google.com//intl/en_ALL/images/logo.gif
Checking included object /index.html: is text.
Checking included object /sorrypage/intl/en_ALL/images/logo.gif: is an image.

Done.
Completed files can be found in /tmp/irulegen-18583/output/.

Do you want to deploy this iRule and associated data groups now?[Y/n]:
Y

The following partitions were found: Common ops1 ops2

Which partition do you want to install this in?:
ops2

** Backing up /config/bigip.conf as /config/bigip.conf.bak
Saving current config.
/config/bigip.conf was renamed to /config/bigip.conf.bak (492 lines).
/config/bigip_local.conf was renamed to /config/bigip_local.conf.bak (3 lines).
/config/bigip_sys.conf was renamed to /config/bigip_sys.conf.bak (32 lines).
Modified bigip.conf
Placed /var/class/sorrypage.index.html.class
Placed /var/class/sorrypage.intl.en_ALL.images.logo.gif.class
Loading new config.
Reading configuration from /defaults/config_base.conf.
Reading configuration from /config/bigip_base.conf.
Reading configuration from /config/bigip_sys.conf.
Reading configuration from /usr/bin/monitors/builtins/base_monitors.conf.
Reading configuration from /config/profile_base.conf.
Reading configuration from /config/daemon.conf.
Reading configuration from /config/bigip.conf.
Reading configuration from /config/bigip_local.conf.
Loading the configuration ...

Rule should be ready to go -- just apply the iRule 'sorry_page_sorrypage' to one or more virtual servers.

Pretty easy, right?  I allowed the script to deploy--here's the iRule:

Sorry Page iRule

 

rule sorry_page_sorrypage {   # Auto-generated by sorry_irule.pl  when HTTP_REQUEST {    #    # Service requests for files (URIs) from the maintenance page    # Note that we always service these pages, even if the http_pool is up    #    set uri [HTTP::uri]    if { $uri equals "/sorrypage" } {       HTTP::respond 301 "Location" "/sorrypage/"       return    }    if { $uri starts_with "/sorrypage/" } {       # trim off the maintenance prefix       set uri [string range $uri 10 end]       # Return the requested page       switch $uri {         "/"              -         "/index.html"   { HTTP::respond 200 content [lindex $::sorrypage_index_html 0] "Content-Type" "text/html" }         "/intl/en_ALL/images/logo.gif"   { HTTP::respond 200 content \ [b64decode [lindex $::sorrypage_intl_en_ALL_images_logo_gif 0]] "Content-Type" "image/gif" }         default         { HTTP::respond 404 }       }       return    }    #    # If the http_pool is down, redirect to the maintenance page    #    if { [active_members [LB::server pool]] < 1 } {      HTTP::redirect "/sorrypage/index.html"      return    }  }   partition ops2}

 

 

Definitely the way to go if you plan on hosting your sorry page on the BIG-IPClick here for the code.

 

Follow me on Twitter Follow me on LinkedIn Follow me on Facebook Add to Technorati Favorites