Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Answers

Displaying maintenance page from the F5 using ifile and irule

Hi All, I am trying to display maintenance page using iFile and iRule but it is not working. I am currently on version 11.5.3 HF1. I created an HTML maintenance page and import it via File Management and added to iFiles. Whenever I try to hit the VIP from browser, maintenance page does not come up. I am using following iRule:

 when HTTP_REQUEST {
    if { [active_members [LB::server pool]] == 0 }{
        HTTP::respond 200 content "[ifile get my_maintenance_File]" noserver Cache-Control no-cache Connection Close
    }
}
0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

I've done something similar using the LB_FAILED event to get the same results. In this example there are three iFiles (CSS, PNG, HTML). You can use an iRule like this one:

when LB_FAILED {
   switch [HTTP::path] {
     "/css/Unavailable.css" {
       HTTP::respond 200 content [ifile get "Maintenance-css"] "Content-Type" "text/css"
       return
     }
     "/img/MaintenanceLogo.png" {
       HTTP::respond 200 content [ifile get "Maintenance-png"] "Content-Type" "image/png"
       return
     }
   }
   HTTP::respond 200 content [ifile get "Maintenance-html"] "Content-Type" "text/html"
}

Hope this example helps!

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

A common gotcha with a Maintenance page is that if the pool members are all down, then the Virtual is marked down, and the connection is rejected before the irule can deliver content.

You need to ensure that the virtual state is disconnected from the pool member state. Or use a fallback host in the http profile to deliver the maintenance message

0
Comments on this Answer
Comment made 6 days ago by Frank 133

Thanks Guys, S Blakely, Can you please let me know how can I disconnect virtual state from Pool member state? ... I won't be able to use fall back host as I am using iFiles. Not sure if I can point fall back host to iFiles

0