I have an irule to look for specific attribute in http header , if it matches it need to go to the pool else to the default pool
when HTTP_REQUEST { if { [HTTP::header “SOAPAction”] equals "; } { pool prod_ro } elseif { [HTTP::header “SOAPAction”] equals "; } { pool copient_prod_ro } elseif { [HTTP::header “SOAPAction”] equals "; } { pool prod_ro } else { pool prod_pool } } but when my prod_ro pool is offline , i dont see all the traffic getting routed to prod_pool.
Nothing in the iRule is checking on whether the prod_ro pool has available members. See here for more details on how you might detect this condition.
Hi sandiksk,
try out the below, haven’t tested. But you’ll get the point on how to fix this…
when HTTP_REQUEST {
switch -glob [HTTP::header "SOAPAction"] {
"http://www.tech.com/CustomerWebsite/Details" -
"http://www.tech.com/CustomerWebsite/Points" {
if { [active_members prod_ro] > 0 } {
pool prod_ro
} else {
pool prod_pool
}
}
"http://www.tech.com/CustomerInquiry/Balances" {
if { [active_members copient_prod_ro] > 0 } {
pool copient_prod_ro
} else {
pool prod_pool
}
}
default { pool prod_pool }
}
}
thankyou for your response , but with above irule it is throwing exception, with the if statement to check the pool member availability.
Pls share us the error msg. A snapshot if possible. I’ll try out this if possible & update you.
when HTTP_REQUEST { if { [HTTP::header “SOAPAction”] equals "; } { pool prod_ro } elseif { [HTTP::header “SOAPAction”] equals "; } { pool prod_ro } elseif { [HTTP::header “SOAPAction”] equals "; } { if { [active_members prod_ro] > 0 } pool prod_ro } else { pool prod_pool }
}
01070151:3: Rule :irule:7: error: [missing a script after “if”][]
with if else if , i cannot run another if condition.
That’s not what I shared in the Irule code above. Where you able to test that.
Nevertheless, the Irule you share here, has syntax problem, here’s the correct version with indentation, so that you can close the loops properly.
when HTTP_REQUEST {
if { [HTTP::header "SOAPAction"] equals "http://www.tech.com/Details" } {
pool prod_ro
} elseif { [HTTP::header "SOAPAction"] equals "http://www.tech.com/ValueBalances" } {
pool prod_ro
} elseif { [HTTP::header "SOAPAction"] equals "http://www.tech.com/ValuePoints" } {
if { [active_members prod_ro] > 0 } {
pool prod_ro
} else {
pool prod_pool
}
}
}
Or combining both the if & elseif with a OR operator.
when HTTP_REQUEST {
if { ([HTTP::header "SOAPAction"] equals "http://www.tech.com/Details") || ([HTTP::header "SOAPAction"] equals "http://www.tech.com/ValueBalances") } {
pool prod_ro
} elseif { [HTTP::header "SOAPAction"] equals "http://www.tech.com/ValuePoints" } {
if { [active_members prod_ro] > 0 } {
pool prod_ro
} else {
pool prod_pool
}
}
}
Do i need to check the node >0 if { [active_members prod_ro] > 0 } . If not the traffic need to go to the default pool prod_pool.
when HTTP_REQUEST { if { [HTTP::header “SOAPAction”] equals "; } { if { [active_members prod_ro] > 0 pool prod_ro } elseif { [HTTP::header “SOAPAction”] equals "; } { if { [active_members prod_ro] > 0 pool prod_ro } elseif { [HTTP::header “SOAPAction”] equals "; } { if { [active_members prod_ro] > 0 } pool prod_ro } else { pool prod_pool }
}
I would suggest you to look at the 1st rule I shared and see if that helps. That has the active member checking option already.