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

Jboswell_33438's avatar
Jboswell_33438
Icon for Nimbostratus rankNimbostratus
Oct 29, 2015

How do I add html content and an ifile in the same maintenance page irule?

Sorry about such a seemingly simple question but I'm new to this and I am struggling trying to make it work. I have no problem displaying either HTML or an image but I can't get both to display at the same time. I want the HTML on top and the image beneath. In my example below, where would I place the RES variable to get the image to show along with the MTC_Content for html.

when HTTP_REQUEST { set RES [ifile get resoutage] set MTC_Content { Maintenance


`


    Insert content here.....
    ..........
    ...........

`    


"
  } 
HTTP::respond 200 content $MTC_Content
}

1 Reply

  • try this kind of irule:

    when HTTP_REQUEST {
        switch [HTTP::path] {
            "/maintenance/logo.png" {
                HTTP::respond 200 content [ifile get "logo.png"] "Content-Type" "image/png"
                return
            }
            "/maintenance/maintenance.html" {
                HTTP::respond 200 content [ifile get "maintenance.html"] "Content-Type" "text/html"
                return
            }
            default {
                set dpool [LB::server pool]
                if { [active_members $dpool] == 0 } { HTTP::redirect "/maintenance/maintenance.html"; unset dpool; return}
                unset dpool
            }
        }
    }