Forum Discussion
Yes, this can be achieved using an iRule, but you'll want to be quite clear about the conditions that can trigger this. The very high-level logic is this:
when HTTP_RESPONSE {
if { } {
set condition_started_at [table lookup condition]
if { $condition_started_at eq "" } {
table set condition [clock seconds] indef indef
}
else {
if { [clock seconds] > $condition_started_at } {
HTTP::respond 200 contents {
}
}
}
}
else {
table delete condition
}
}
}
I haven't tested this, since it's just psuedo-code. For the HTTP::respond you may consider using an iFile, as has been suggested in other posts.
You should be aware that both the table calls and the clock calls are fairly costly. There is an alternative form that uses static:: variables and a Tcl Associative Array, but that means each tmm will compute the condition independently. That might be okay for you, and it is considerably cheaper/faster than using table.
Yes. The solution above does that. The snippet:
HTTP::respond 200 contents { ... }
responds with a 200 (OK) and with the contents between the braces (presumably the HTML of your maintenance page). Once again, using an iFile to store your maintenance page usually makes more sense.