Forum Discussion
warren_beaudry_
Nimbostratus
Jul 26, 2013irule to load custom page via ifile when HTTP::status !200
Good day, DevCentral is an incredible resource but I thought I throw out my specific scenario for the community's opinion.
We're looking to load a "friendly" page via ifile to send to the...
warren_beaudry_
Nimbostratus
Jul 30, 2013Great thanks.
I'm now on phase 2 of my issues :-)
Loading the image file; I have the png loaded as an ifile but can't seem to link to it from the html
This seems to work (at least the 404 part which I've tested):
when HTTP_RESPONSE {
if { [HTTP::status] != "200"} {
switch [HTTP::status] {
"404" { HTTP::respond 200 content [ifile get "/Common/404.html"] noserver
}
"503" { HTTP::respond 200 content [ifile get "/Common/503.html"] noserver
}
default { HTTP::respond 200 content [ifile get "/Common/unexpected.html"] noserver
}
}
}
}
These html pages all link to a png file (our logo) which isn't loading.
All of the articles I've found related to linking to an image file using ifile is of this type:
when HTTP_REQUEST {
if { [HTTP::uri] eq "/" } {
HTTP::respond 200 content [ifile get testapp_index_txt]
} elseif { [HTTP::uri] eq "/f5b_mini.png" } {
HTTP::respond 200 content [ifile get testapp_f5ball_img]
} else { discard }
}
Can I use HTTP_RESPONSE to evaluate the HTTP::status and then use HTTP_REQUEST to deliver the ifiles in one irule?
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects