03-Sep-2013 21:50
Hi Friends,
Could anyone help me with an iRule to send a http 400 status when all the pool members in a pool are offline. Typically I would use a go-away iRule with a redirect url. but my case is dealing with web service calls not using the browser component, redirect url doesnt serve my purpose. I would want something like http 400 status code to be issued by F5 when all pool members are offline. Thanks for your help.
-KK
03-Sep-2013 22:05
However, the redirect solution leaves much to be improved. You can implement an irule to read from an ifile to avoid any redirect, so the end-user can simply do a page reload to check if the site back up again.
This has been such an FAQ and use case that it warrants a feature request to F5.
03-Sep-2013 22:52
Try this untested iRule.
when HTTP_REQUEST {
if { [active_members [LB::server pool]] == 0 } {
HTTP::respond 400 content "Bad Request page\
400 - The request could not be understood by the server due to malformed syntax. \
" "Content-Type" "text/html"
return
}
}
04-Sep-2013 09:26
Scratch that first irule. It was untested and has flaws. I agree with Jie about the no-cache. Give this one a try.
when HTTP_REQUEST {
if { [active_members [LB::server pool]] == 0 } {
HTTP::respond 400 content "
Bad Request page
400 - The request could not be understood by the server due to malformed syntax.
" Cache-Control No-Cache Pragma No-Cache"
}
}
05-Sep-2013 03:56
06-Sep-2013 22:28
04-Sep-2013 15:04
HTTP Status 400 pages shouldn't be cached, if clients are acting appropriately. You know, since all web clients always response exactly according to RFCs right? Right??
Still...not a terrible idea to force said behavior. Good call, Jie. 😉
Colin