Forum Discussion
pool down redirect problem
Ok thanks. I think I understand. It flows through and finds the /maintenance and applies that as the response, then it hits the pool_down and also tries to apply that as a response. Is that right?
I ended up making three irules. The first one isn't attached to anything it just initializes the global variables. The second one checks for the uri of /maintenance and then calls an "event disable all". The third one then corrects certificate errors and status of the pool. Is this a proper way to do it?
...iRule number one (not assigned)
when RULE_INIT {
set ::wwwqawait 10
set ::wwwqaprot "https://"
set ::wwwqahost "www.site.com"
set ::wwwqafail "/maintenance"
set ::wwwqapool "Test_POOL"
}
...iRule number two
when HTTP_REQUEST {
check to see if the URI of the request starts with /maintenance
if { [string tolower [HTTP::uri]] starts_with "$::wwwqafail" }
{
HTTP::respond 200 content blah-server-down
...redirects to wwwqahost in wwqawait seconds...
event disable all
}
...iRule number three
when HTTP_REQUEST {
check to make sure connection is secure
if { [TCP::local_port] != 443 }
{
HTTP::redirect $::wwwqaprot[HTTP::host][HTTP::uri]
}
make sure a short host (2-part) is a correct match for our certificate (3-part)
if { [string length [getfield [HTTP::host] "." 3]] == 0}
{
HTTP::redirect $::wwwqaprot$::wwwqahost[HTTP::uri]
}
make sure a long host is a correct match for our certificate
if { [string length [getfield [HTTP::host] "." 4]] > 0}
{
HTTP::redirect $::wwwqaprot[domain [HTTP::host] 3][HTTP::uri]
}
check to see if the pool is down. if so, redirect to the maintenance page
if { [active_members $::wwwqapool] < 1 }
{
HTTP::redirect $::wwwqaprot$::wwwqahost$::wwwqafail
}
end http request block
}
when HTTP_RESPONSE {
HTTP::header remove Server
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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