Forum Discussion
Ravi_Rajan_7549
Nimbostratus
Aug 02, 2006Redirecting Certain Apps
Hi,
I am quite new to irules and have a query.
I have 15 web applications in my web server. I have requirement that in case of maintenance windows, 10 out of above 15 apps needs to...
hoolio
Cirrostratus
Aug 02, 2006Hello Ravi,
You could create a datagroup (class) with a list of the apps that are down, and then use something like this to redirect all requests to a host listed in the datagroup to a maintenance page.
Go to Local Traffic >> iRules and click on the Datagroups tab to create a datagroup. Select type string and add the apps that you want to redirect requests for.
The config file entry for the datagroup will look like this:
class disabled_apps {
"app1"
"app10"
"app2"
}You can then use a rule like this to redirect requests for a disabled app:
set app_number [getfield [HTTP::uri] "/" 2]
if { [matchclass $app_number equals $::disabled_apps] }{
log local0. "App: $app_number. Request from client [IP::remote_addr] for [IP::local_addr][HTTP::uri] was redirected"
HTTP::redirect "http://mymaintenancepage.com"
}It delineates the URI by /'s and gets the second field. If that value is listed in the disabled_apps class, the request is redirected. If there isn't a match, the request is handled by the VIP's pool configuration.
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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