ramki_75145
Dec 19, 2007Nimbostratus
maintenance messages
I'm new to iRules and trying to create iRule for different HTTP status codes and serverdown condition.
I took some of the code from other posts in this form. Here is the iRule i got. I'm getting error messages when i'm saving this iRule in F5. Could someone please help in fixing these error messages.
--------------------------------------
when RULE_INIT {
set error_404 {
Sorry, but the page you requested could not be found.
Please check that the requested page was typed properly and try again.
}
set Servers_down {
Sorry, Servers are currently down for maintenance.
Please check back in 10 minutes.
}
}
when HTTP_RESPONSE {
if {[active_members [LB::server pool]] == 0}
{
HTTP::respond 200 content [subst $::Servers_down]
}
else {
if { [HTTP::status] != 401 }
{
if { [HTTP::status] == 404 }
{
HTTP::respond 200 content [subst $::error_404]
}
else {
if { [HTTP::status] >= 500 }
{
HTTP::respond 200 content [subst $::Servers_down]
}
}
}
}
}
--------------------------------------
ERROR MESSAGES:
01070151:3: Rule [CASErrorCustomMessage] error:
line 34: [missing a script after "if"] [ ]
line 35: [undefined procedure:
if { [HTTP::status] == 404 }
{
HTTP::respond 200 content [subst $::error_404]
}
else {
if { [HTTP::status] >= 500 }
{
HTTP::respond 200 content [subst $::Servers_down]
}
}
] [{
if { [HTTP::status] == 404 }
{
HTTP::respond 200 content [subst $::error_404]
}
else {
if { [HTTP::status] >= 500 }
{
HTTP::respond 200 content [subst $::Servers_down]
}
}
}]
I appreciate your help. Thanks rk.