jmas08
Jun 18, 2009Nimbostratus
Help Conditional Maint Irule
Hey Guys,
During maintenance I want to be able to present a maint page to extenal users, while internal users get the actual message form the server for testing purposes. I have this but it is not working.
when HTTP_REQUEST {
sets the timer to return client to host URL
set stime 10
Use the Host header value for the responses if it's set. If not, use the VIP address.
if {[string length [HTTP::host]]}{
set host [HTTP::host]
} else {
set host [IP::local_addr]
}
Check if the URI is /maintenance
switch [HTTP::uri] {
"/maintenance" {
Send an HTTP 200 response with a Javascript meta-refresh pointing to the host using a refresh time
HTTP::respond 200 content \
"Maintenance\
Our Apologies
The application you requested is currently undergoing maintenance. It should be available soon. Please try again later.
" "Content-Type" "text/html"
return
}
}
If the pool_testLB is down, redirect to the maintenance page
if { 0 == [active_members [LB::server pool]] } {
HTTP::redirect "https://$host/maintenance"
return
} else {
return
}
if { (not [ matchclass [IP::client_addr] equals $::Internal-IP ] ) } {
HTTP::redirect "http://$host/maintenance"
return
} else {
return
}
}
Any help is appreciated
Thanks