Forum Discussion
redirect not working
Paulius , thankyou so much for looking into this , but the problem with the above logic is when both the pools are down users still need to get the maintenance page but when i try accessing the url abc.test.com -- I get connection rest page cannot be displayed when i access https://abc.test.com/testpage --- it displays me the application down message from the log statement . Dont see any issues with the syntax of the above irule but when both pools are down i see vip is marked down so the else statment is not getting executed i guess.
tmm[31148]: 01220001:3: TCL error: /Common/test-irule <HTTP_REQUEST> - Operation not supported. Multiple redirect/respond invocations not allowed (line 10) invoked from within "HTTP::respond 503 content [ifile get "applicationdown.html"]"
It seems that something could be wrong with the iFile possibly. If you can provide me the contents of the iFile I might be able to test this in my lab and see if I can get it to work.
- sandikskMay 10, 2024
Nimbostratus
sent an email with the details ,redirect to maintenance is not needed we need logic only when both the pools are down route the traffic to point to ifile without any uri redirect.
We need uri redirect for the default pool 1, when pool1 is down and traffic is fwded to pool2 based on the condition . In all these scenarios i need HTTP::redirect.
- PauliusMay 10, 2024
MVP
I'm a bit confused as to what the request is. It might be helpful for you to divide up everything that you want into a numbered list. An example of my confusion, your first if statement says to send traffic to pool1 if it has zero members available. Doing the previous would result in a failed connection because no members are available in pool1. You then check the source of the connection and that pool2 has active members which then sends traffic to pool2 and then checks for URI path "/" and does a redirect to "/testpage/" if "/" is the URI. Then if pool2 has all members down then you return the contents of the ifile "applicationdown.html".
- sandikskMay 10, 2024
Nimbostratus
Below is the logic i am trying to achieve , but is it possible to simplfy the logic rather than applying too many if conditions
when HTTP_REQUEST {
if { [active_members pool1] != 0 }{
if { [HTTP::uri] == "/" } {
HTTP::redirect "https://[HTTP::host]/testpage/"
}
}
if { [active_members pool1] == 0 }{
if { ( ( [class match [IP::client_addr] eq "whitelist"] ) && ( [active_members pool2 ] > 0 ) ) }
{
pool pool2
if { [HTTP::uri] == "/" } {
HTTP::redirect "https://[HTTP::host]/testpage/"
}
}
else {
HTTP::respond 503 content [ifile get "applicationdown.html"]
}
}
} - PauliusMay 10, 2024
MVP
It looks like you have some syntax errors in the iRule you provided, try the following one in place of yours.
when HTTP_REQUEST priority 500 { if { [active_members pool1] != 0 } { if { [HTTP::uri] == "/" } { HTTP::redirect "https://[HTTP::host]/testpage/" } } elseif { [active_members pool1] == 0 } { if { ( ( [class -- match [IP::client_addr] == "whitelist"] ) && ( [active_members pool2 ] > 0 ) ) } { if { [HTTP::uri] == "/" } { HTTP::redirect "https://[HTTP::host]/testpage/" } else { pool pool2 } } else { HTTP::respond 503 content [ifile get "applicationdown.html"] } } }
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
