Language Aware Maintenance Page

It seems to be an expectation now that web-applications are language and location-aware. When a web application fails, the F5 can present a ‘sorry’ page using a variety of methods. I’ve found that the iFile presentation of HTML files using iRules to be the easiest for me.

In addition to detecting the health of members in a pool, this iRule includes the detection of the users browser Accept-language to forward them to the correct language sorry page. Assign this iRule to your virtual server and it will start working once a pool has zero healthy nodes in it.

The following iRule checks to see if there are less than one member in a pool. If this is the case–the header in request is then checked to check the Accept-Language and present the correct HTML page based on that field. I check for French, Japanese and the default is English. Add additional languages as needed and their respective HTML page to present to users. Of course you will need to create and import your maintenance page into the F5 and then add it to the iRule iFile list.

when HTTP_REQUEST {
 if {[active_members [LB::server pool]] < 1} {
 log local0.crit "Server Pool: [LB::server pool] has failed"
 switch -glob [HTTP::header "Accept-Language"] {
 "fr*" {
 HTTP::respond 200 content [ifile get maintenance.fr.html] "Content-Type" "text/html"
 }
 "ja*" {
 HTTP::respond 200 content [ifile get maintenance.jp.html] "Content-Type" "text/html"
 }
 default {
 HTTP::respond 200 content [ifile get maintenance.en.html] "Content-Type" "text/html"
 }
 }
 }
}