12-Oct-2020 13:56
Hi Team,
Need assistance to fix an I rule. Below are the requirements:
1) If VS works fine then any traffic matching URI " N=197" & "Nrpp=25 "needs to re-directed as usual.
2) When all the Pool members are down " N=197" URI need to re-direct to ABC maintenance page and URI "Nrpp=25 " needs to be redirected to XYZ URL
I have tried with few I-rules but not getting expected response. I am not able to re-direct to maintenance pages for both the URI's.
My I-rule:
when HTTP_REQUEST {
if { [active_members [LB::server pool]] == 0 && [[HTTP::uri] contains "N=197"] } {
HTTP::redirect "https://d-www.abc.com/system-maintenance"
}
elseif { [active_members [LB::server pool]] == 0 && [[HTTP::uri] contains "Nrpp=25"] } {
HTTP::redirect "http://s-www.xyz.com/maintenance/index.html"
}
}
or I-rule :
when HTTP_REQUEST {
if { ( [[active_members [LB::server pool]]] < 1 ) & & ( [[HTTP::uri] contains "N=197"] ) } {
HTTP::redirect "https://d-www.abc.com/system-maintenance"
}
elseif { ( [[active_members [LB::server pool]]] < 1 ) & & ( [[HTTP::uri] contains "Nrpp=25"] ) } {
HTTP::redirect "http://s-www.xyz.com/maintenance/index.html"
}
}
13-Oct-2020 02:00
Hi Shailesh,
Can you try this iRule and look logs?
when HTTP_REQUEST {
if { [active_members [LB::server pool]] < 1 } {
log local0. "All members down. URI=[HTTP::uri]"
switch -glob [string tolower [HTTP::uri]] {
"*n=197*" { HTTP::redirect "https://d-www.abc.com/system-maintenance" }
"*nrpp=25*" { HTTP::redirect "http://s-www.xyz.com/maintenance/index.html" }
}
}
}