NiHo_202842
Sep 16, 2016Cirrostratus
What to do after HTTP::respond ?
Hello,
I currently have a maintenance-unavailable iRule that returns a HTML page when the vs is in maintenance mode (value in datagroup list) or is not available. (LB_FAILED)
My first check is if the URI is an image that is linked to in the page. If yes, HTTP::respond with a Connection: Close header, disable all future iRule events & TCP::close. This seems a very hacky way of doing this. I manually close the TCP connection because for some apps, we have an IIS request forwarder in front of the bigip that may do connection pooling; event disable all would disable all iRules for all applications on that TCP connection.
How are you all doing this?
priority 50
when HTTP_REQUEST {
if { [HTTP::uri] eq "/bip-company-logo.gif" }{
HTTP::respond 200 content [ifile get "company-logo"] noserver Content-Type image/gif Connection Close
event disable all
TCP::close
return
}
if { [class match -value [virtual name] equals "maintenance-list"] eq "1" } {
if { [HTTP::uri] eq "/favicon.ico" }{
HTTP::respond 404 noserver Connection Close
event disable all
TCP::close
return
}
if { [virtual name] starts_with "/ITSS/" }{
set contact "your Regional Helpdesk"
} else {
set contact "Application Support () or your Regional Helpdesk"
}
HTTP::respond 200 content "
Down for maintenance - company
Maintenance
This application is currently undergoing maintenance.
It should be available again within the specified time period.
For any questions, please contact $contact.
" noserver Connection Close
event disable all
TCP::close
}
}
when LB_FAILED {
if { [virtual name] starts_with "/ITSS/" }{
set contact "your Regional Helpdesk"
} else {
set contact "Application Support () or your Regional Helpdesk"
}
HTTP::respond 503 content "
Application Unavailable - company
Application unavailable
This application is currently not available.
Please contact $contact.
" noserver Connection Close
event disable all
TCP::close
}