jkstraw_44238
Oct 09, 2007Nimbostratus
redirect to maint. page
Hello,
I have read a number of posts on how this can be done based on a pool being down but I think my situation/requirement may be unique.
We are running a JBoss/Tomcat webapp where there are multiple customers on the same domain (virtual server) - only differentiated by their unique URI.
To accomplish the load balancing we implemented an irule that looks like this:
when HTTP_REQUEST {
set http_request_time [clock clicks -milliseconds]
set request_log_line "[HTTP::request_num] - [IP::remote_addr] - [HTTP::method] - [HTTP::version] - [HTTP::host] - \
\"[HTTP::uri]\" - \"[HTTP::header value Referer]\" - \"[HTTP::header User-Agent]\" - \"[HTTP::cookie value JSESSIONID]\" - \
[SSL::cipher name] - [SSL::cipher version] - [SSL::cipher bits]"
switch -glob [string tolower [HTTP::uri]] {
"/test01*" {
use pool cluster01
}
"/test02*" {
use pool cluster02
}
"/test03*" {
use pool cluster01
}
"/test04*" {
use pool cluster02
}
"/test05*" {
use pool cluster01
}
"/*" {
set resp_url "http://www.somedomain.com"
TCP::respond "HTTP/1.1 302 Found\r\nLocation: $resp_url\r\nConnection: close\r\nContent-Length: 0\r\n\r\n"
TCP::close
}
}
}
when HTTP_RESPONSE {
set http_response_time [clock clicks -milliseconds]
log local0. "$request_log_line - [HTTP::status] - [HTTP::payload length] - [expr $http_response_time - \
$http_request_time] - pool [LB::server pool] - node [LB::server addr]"
}
Part of our ongoing procedures is to patch existing clients to new versions of our software - to do this we undeploy the webapp, patch it and then redeploy the webapp.
I am trying to find a way to have the LTM automatically redirect traffic to a maintenance page when the webapp becomes unavailable (ie. has been undeployed by our patching script).
The posts I have read in the forum so far have a dependency on a pool or pool member health check report as being down - thus triggering the redirect portion of the rule. However in our case all pool members are still available, as is the backend application server - the webapp simply is not deployed.
I had thought about having the redirect trigger on certain HTTP response codes (eg. 404) but I don't think this is feasible because certain parts of the app throw the 404 out as part of normal operating functions.
Does anyone have any ideas on how I could accomplish this functionality?