Forum Discussion
scarpozzi_82104
Nimbostratus
Dec 09, 2010Redirection when clients are at /
I've got a portal server that will be unavailable weekly due to some oracle cold backups. I've got an iRule that sets up the maintenance window and gives me controls to automate the recurring window...
hoolio
Cirrostratus
Dec 09, 2010An HTTP client cannot send a null URI. Something like this should do:
when HTTP_REQUEST {
Check for anything not portal.site.com/
if {"[string tolower [HTTP::host]][HTTP::uri]" eq "portal.site.com/"}{
pool maint_pool
} else {
HTTP::redirect "http://portal.site.com/"
}
}
This assumes that portal.site.com/ doesn't reference any other URIs under portal.site.com. If it did, you could add them to a switch statement:
when HTTP_REQUEST {
Check for host of portal.site.com
if {[string tolower [HTTP::host]] eq "portal.site.com"}{
Check if URI is a maintenance URI
switch -glob [HTTP::uri] {
"/maint/*" -
"/maintenance.jpg" -
"/maintenance.css" -
"/maintenance.html" {
pool maint_pool
return
}
}
}
If we're still in the iRule, the request wasn't for a maintenance URI, so redirect the request
HTTP::redirect "http://portal.site.com/"
}
Aaron
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