Forum Discussion

Macaron's avatar
Macaron
Icon for Nimbostratus rankNimbostratus
Sep 13, 2017

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
    }
}

2 Replies

  • wlopez's avatar
    wlopez
    Icon for Cirrocumulus rankCirrocumulus

    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!

  • 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