You can only use an HTTP:: command once the HTTP has been parsed. The HTTP hasn't been parsed in the CLIENT_CONNECTED event, so the HTTP::redirect command is invalid. You can issue a redirect in the HTTP_REQUEST event though (when LTM parses the HTTP headers in a request). If you only want to redirect the client during a maintenance window, you could use a separate rule:
when HTTP_REQUEST {
checks to see if client_addr = any in the class
if { not ([matchclass [IP::client_addr] equals $::private_net])} {
HTTP::redirect http://maintenance.example.com
}
}
Else, if you want to combine the two in the HTTP_REQUEST event, here's an example:
when HTTP_REQUEST {
checks to see if client_addr = any in the class
if { [matchclass [IP::client_addr] equals $::private_net]} {
snat automap
use pool g_pool
} else {
HTTP::redirect http://maintenance.example.com
snat none
use pool g_pool
}
}
Aaron