For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

bobbyd1282_1424's avatar
bobbyd1282_1424
Icon for Nimbostratus rankNimbostratus
Apr 29, 2014

F5 Lite Maintenance Page iRule works on Virtual Servers except when the Virtual Server is Listening on 443 (HTTPS)

Hello

I'm not a programmer and so I'm no too good with iRules but, here is my issue. Any help would be great. I want a simple message (no images or anything) to be displayed when 0 pool members are available in a pool. Currently I have two Virtual Servers I am trying to apply the below iRule to. One Virtual Server is listening on all ports and the iRule is working as expected. The other is listening on 443 (HTTPS) AND is doing SSL Off loading but, does NOT display the maintenance page when there are 0 pool members available. The iRule statistics show the iRule is being executed without error but the site just hangs eventually throwing up a error that the webpage cannot be displayed. The iRule is the same on both farms with the only difference being the name of the pool its using to check if there are available members. Any help is appreciated. Again I'm just looking to display a white page with a informational sentence. Nothing Fancy.

when HTTP_REQUEST {

  sets the timer to return client to host URL 
 set stime 10 

  Use the Host header value for the responses if it's set.  If not, use the VIP address. 
 if {[string length [HTTP::host]]}{ 
 set host [HTTP::host] 
 } else { 
 set host [IP::local_addr] 
 } 

  Check if the URI is /maintenance 
 switch [HTTP::uri] { 
 "/maintenance" { 

  Send an HTTP 200 response with a Javascript meta-refresh pointing to the host using a refresh time 
 HTTP::respond 200 content \ 

"Maintenance page \

We are sorry! This page is currently under maintenance and should be available as soon as our work is complete. Sorry for any inconvenience.

" "Content-Type" "text/html"

return } } If the pool is down, redirect to the maintenance page if { [active_members ] < 1 } { HTTP::redirect "http://$host/maintenance" return } }

3 Replies

  • when HTTP_REQUEST {

      sets the timer to return client to host URL 
     set stime 10 
    
      Use the Host header value for the responses if it's set.  If not, use the VIP address. 
     if {[string length [HTTP::host]]}{ 
     set host [HTTP::host] 
     } else { 
     set host [IP::local_addr] 
     } 
    
      Check if the URI is /maintenance 
     switch [HTTP::uri] { 
     "/maintenance" { 
    
      Send an HTTP 200 response with a Javascript meta-refresh pointing to the host using a refresh time 
     HTTP::respond 200 content \ 
    

    "Maintenance page \

    We are sorry! This page is currently under maintenance and should be available as soon as our work is complete. Sorry for any inconvenience.

    " "Content-Type" "text/html"

    return } } If the pool is down, redirect to the maintenance page if { [active_members ] < 1 } { HTTP::redirect "http://$host/maintenance" return } }
  • Sorry . This keeps applyint the html code in my iRule Im trying to have someone help me with. Here is the link to the iRule i am using found here on dev central

     

    https://devcentral.f5.com/wiki/iRules.LTMMaintenancePageLite.ashx

     

  • If you don't need images, then it's probably easier to ignore the URI inspection code and just look at active_members:

     

    when CLIENT_ACCEPTED {
        set default_pool [LB::server pool]
    }
    when HTTP_REQUEST {
        if { [active_members $default_pool] < 1 } {
            HTTP::respond 200 content "...your html code here..."
        }
    }