Forum Discussion
Terrence
Nimbostratus
Jul 09, 2009Writing a generic Irule
A while back I took the LTMMaintenancePage to serve up a maintenance page for the web application. We are about to load balance a second application and would also like to use the maintenance page. ...
Terrence
Nimbostratus
Jul 10, 2009What I wanted is a way to have a variable available to all servers applied to a particular VIP, with a scope of that VIP. I started throwing together a code where I can use a generic maintenance page irule, although it is not how I orginally set out to accomplish it.
class maint_home_css {
type string
filename "/var/class/maint.home.css.class"
}
class maint_index_html {
type string
filename "/var/class/maint.index.html.class"
}
class maint_logo_gif {
type string
filename "/var/class/maint.logo.gif.class"
}
class maint_site_desc {
"lists.aa.net" := "Company's Support Mailing lists"
"cct.aa.net" := "CAS - Central Authentication(Dev)"
"login.aa.net" := "Central Authentication Service(CAS)"
"forums.aa.net" := "Company's Support Forums"
}
rule webserver {
when HTTP_REQUEST {
If the http_pool is down, redirect to the maintenance page
if { [active_members webct-pool] < 1 } {
switch [HTTP::uri] {
"/" -
"/index.html" {
set index_html [b64decode [string map "SITE [class lookup [HTTP::host] maint_site_desc]" [class element 0 maint_index_html]]]
HTTP::respond 200 content $index_html "Content-Type" "text/html"
}
"/logo.gif" { HTTP::respond 200 content [b64decode [lindex $::maint_logo_gif 0]] "Content-Type" "image/gif" }
"/home.css" { HTTP::respond 200 content [lindex $::maint_home_css 0] "Content-Type" "text/css" }
"default" { HTTP::respond 301 "Location" "/" }
}
return
}
}
}
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects