Perhaps there are other redirect iRules which take precedence over your maintenance redirect? You could try using the priority function and see whether it resolves your issue.
priority 10
when HTTP_REQUEST {
if { [HTTP::host] == "www.company.com" } {
HTTP::respond 302 location "http://sorry.company.com"
event disable
TCP::close
}
}
Note: The code above would work only if the maintenance page is not served by the same Virtual Server (listener). If the maintenance page is served via the same Virtual Server, you'll have to add a negative condition to avoid a redirect loop:
priority 10
when HTTP_REQUEST {
if { (([HTTP::host] == "www.company.com") && not([HTTP::path] == "/maintenance")) } {
HTTP::respond 302 location "http://www.company.com/maintenance"
event disable
TCP::close
}
}
Good luck 😉