Forum Discussion
jmas08
Nimbostratus
Jun 18, 2009Help 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
- The_Bhattman
Nimbostratus
Did you take a look at the following Samples - hoolio
Cirrostratus
You'll run into problems using a variable (or datagroup) name with a hyphen in TCL: - jmas08
Nimbostratus
Everything seems to work except detecting the client ip. - hoolio
Cirrostratus
If that's the case, can you change the name of the datagroup from Internal-IP to Internal_IP and retest, or change the iRule to reference the datagroup as ${::Internal-IP}? If you've already done this, can you post your updated iRule and the debug logging showing the issue?
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects