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

Filter by:
  • Solution
  • Technology
Answers

Maintenance page with iFile problem

Hi I have the following iRule to respond a maintenance html page with referenced CSS and Image file ( CSS and Image files are imported in F5 ) . However I can only get to the maintenance html page but cannot render CSS or image files. Is there any limitation on how many HTTP::respond I can issue in one single HTTP_REQUEST ? I am using v.11.2.0

iRule: when HTTP_REQUEST { if { [active_members [LB::server pool]] < 1} { HTTP::respond 200 content [ifile get secure-bd-branded.html] "Content-Type" "text/html" if {[HTTP::uri] ends_with "secure-bd.css"} {HTTP::respond 200 content [ifile get secure-bd.css] "Content-Type" "text/css"} if {[HTTP::uri] ends_with "404-bd.jpg"} {HTTP::respond 200 content [ifile get 404-bd.jpg] "Content-Type" "image/jpg"} if {[HTTP::uri] ends_with "bd-logo.png"} {HTTP::respond 200 content [ifile get bd-logo.png] "Content-Type" "image/png"} } } For example I have referenced the CSS and Image from withing the HTML like following: img src="bd-logo.png" /> link rel="stylesheet" href="secure-bd.css" /> For some reason only first HTTP::respond is working, any request to the CSS and Image is not processing.

Please help.

0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Moinul,

There are a couple of examples available in the irule section.

But this should do the trick:

when HTTP_REQUEST {
if { [active_members [LB::server pool]] < 1 } { 
if { [HTTP::uri] eq "/secure-bd.css" } {
    HTTP::respond 200 content [ifile get secure-bd.css] "Content-Type" "text/css"}
if { [HTTP::uri] eq "/404-bd.jpg" } {
    HTTP::respond 200 content [ifile get 404-bd.jpg] "Content-Type" "image/jpg"}
if { [HTTP::uri] eq "/bd-logo.png} {
    HTTP::respond 200 content [ifile get bd-logo.png] "Content-Type" "image/png"}
} else { HTTP::respond 200 content [ifile get secure-bd-branded.html] "Content-Type" "text/html" "Cache-Control" "no-cache,no-store,must-revalidate" "Expires" "Fri, 01 Jan 1990 00:00:00 GMT"}
}}

I've added in the headers for cache as I had issues with content being cached on a proxy.

0