Sorry page

When we have a full outage of a pool I want to users to be directed to a sorry page. How can I accomplish that?

I will take this low hanging fruit :). Generally, this can be done by writing a script in irule and having an active pool for the "sorry page". You would have to write a rule that triggers a redirect to the the "sorry page" pool when the original target pool has no active members or at capacity.


Example of irule script:


when LB_FAILED {

if { [active_members [LB::server pool]] < 1 } {
# The redirect will be sent only if LB_FAILED
# was because the pool had no available members.
HTTP::fallback "http://host.domain.com/redirect.html"
}
}


You can manipulate one of F5's redirect page templates for "site under maintenance" and have it say "sorry, there are currently more users than we expected on this site, please try again in 10 minutes". Generally, users would hate that sort of sorry page so the admin can get creative here on what kind of messaging should be displayed :).


The easier path here is to use the Fallback Host Option, which has preset values. For the article on understanding on how to redirect client requests based on HTTP server reponses.

https://support.f5.com/csp/article/K7124

Charles reply is one option and works perfectly in some use cases. Personally I prefer to respond with a sorry page directly from the F5 unit with HTTP::respond as it responds to a request rather than redirect it. Couple this with some cloud hosted images and you'll make sure that as long as the LB is up, something will always respond to customers.


This means that customers seeing the sorry page can hit F5 while maintaining their URI. If redirecting all they'd do is to refresh the sorry page and potentially stay there (unless it has some smart javascripts). Because of these reasons there's actually an Indeni check for the use of fallback pages (but only through HTTP profiles at the moment, thank you Charles for reminding me about the iRule option!).


Simple sorry page iRule:

when LB_FAILED {
HTTP::respond 503 content "&lt;html&gt;&lt;body&gt;Sorry we"re not able to handle your request right now&lt;/body&gt;&lt;/html&gt;"

}

If you’d like you could add some HSL (high speed logging) to send a syslog message for every request that is not served:

when LB_FAILED {
#Create an HSL interface
set hsl [HSL::open -proto UDP -pool syslog-server_pool]

#Send the message
HSL::send $hsl "&lt;190&gt; [IP::local_addr] [HTTP::uri]\n"

HTTP::respond 503 content "&lt;html&gt;&lt;body&gt;Sorry we"re not able to handle your request right now&lt;/body&gt;&lt;/html&gt;"

}

Please note that the HSL example is just a simple one. It’s possible to mimic an IIS log or format it however you want here.


Notice how there’s not check for active members there? This means that the LB would show the sorry page in all instances where it’s unable to establish a server side connection to the servers, be it routing, failed pool member monitors, incompatible server side protocol etc. whereas if checking for active_members it’d only show the sorry page when all members are down.


But as with everything else F5 and iRules, it’s all about what you want and need. :slight_smile:


/Patrik


Ps. I wrote most of the above from the top of my head so it’s not syntax tested. Please let me know if you encounter any issues. Ds.