Forum Discussion
MK_62657
Nimbostratus
Feb 13, 2008Using F5 as a fall back host
Hello:
Is any using the F5 device itself as a fall back host? I would like to host the maintenance page on the device itself if possible instead of having another server as the fallback host...
hoolio
Cirrostratus
Mar 19, 2008That's close. The /error/image.png only exists in the HTML you're sending to the client from the iRule. Can you give this a try?
I added some logging so you can check the /var/log/ltm log file for debug info if it doesn't work. You can check the file on the CLI using tail -f /var/log/ltm, (ctrl+c to stop tailing the file), or in the GUI under System >> Logs >> Local Traffic. Make sure to comment out the debug statements once you're done testing.
when RULE_INIT {
set ::polr_html {All Servers Down}
}
when HTTP_REQUEST {
log local0. "Received request from [IP::client_addr] to [HTTP::host][HTTP::uri], with [active_members myPool]"
Check if the pool has any active members
if {[active_members myPool] == 0}{
log local0. "No active members"
The error condition was true, so respond back to client from the iRule
switch [string tolower [HTTP::path]] {
/error/image.png {
log local0. "Request was for /error/image.png"
HTTP::respond 200 content [b64decode [lindex $::logo_png_class 0]] "Content-Type" "image/png"
}
default {
log local0. "Request was not for the image, so we're sending the HTML"
HTTP::respond 200 content $::polr_html
}
}
}
}
Aaron
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