Forum Discussion

jerm1020_254086's avatar
jerm1020_254086
Icon for Nimbostratus rankNimbostratus
Aug 04, 2016

irule maintanance page issue

Can anyone out there tell me what could be wrong with this code for an irule to reference HTML for a maintance splash page?

 

when HTTP_REQUEST { if { [active_members [LB::server pool]] == 0 } { 
 check if client access from internal subnet
if { [IP::addr [IP::client_addr]/8 equals 10.0.0.0] } {
    pool alternate_pool
} else {
    HTTP::respond 200 content {   Sorry Page   Sorry, The website is not available. Please try again later  }
}

}

 

I am losing my mind over trying to figure it out. it is giving me a missing bracket error and when I input it into notepad++ it isn't showing any error. here is the errors it is giving me

 

01070151:3: Rule [/Common/test_maintanance] error: /Common/test_maintanance:1: error: [parse error: missing close-brace][{ if { [active_members [LB::server pool]] == 0 } { check if client access from internal subnet if { [IP::addr [IP::client_addr]/8 equals 10.0.0.0] } { pool alternate_pool } else { HTTP::respond 200 content { Sorry Page Sorry, The website is not available. Please try again later } } }] /Common/test_maintanance:2: error: [command is not valid in the current scope][if { [active_members [LB::server pool]] == 0 } { check if client access from internal subnet if { [IP::addr [IP::client_addr]/8 equals 10.0.0.0] } { pool alternate_pool } else { HTTP::respond 200 content { Sorry Page Sorry, The website is not available. Please try again later } }

 

1 Reply

  • Hi Jerm,

     

    I've correctly formated the code and found a missing closing braked at the end...

     

    when HTTP_REQUEST { 
        if { [active_members [LB::server pool]] == 0 } { 
             check if client access from internal subnet
            if { [IP::addr [IP::client_addr]/8 equals 10.0.0.0] } {
                pool alternate_pool
            } else {
                HTTP::respond 200 content {   Sorry Page   Sorry, The website is not available. Please try again later  } noserver "Content-Type" "text/html"
            }
        }   
    }

    Cheers, Kai