http redirect with multiple condetion
Hello
I am trying to redirect http request coming to my F5s to another path, i have a working iRule but the new requirement is, since my VIP has multiple A records, the developers do not know which one is correct therefore i need to change my iRule logic.
I am putting the final destination as a pool in my F5 due to some challenges which we had and by adding the destination in my F5 as a pool we do not have any issue.
can you please check if below iRule is good or do you see any issue, all tree http request for aaa.com bbb.com and ccc.com should go to one endpoint which is api.com
Thanks
Mohammad
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "aaaa.com" } {
HTTP::header replace "Host" "api.com"
set current_uri [HTTP::uri]
HTTP::uri "/something$current_uri"
pool new-pool
}
elseif { [string tolower [HTTP::host]] equals "bbbb.com" } {
HTTP::header replace "Host" "api.com"
set current_uri [HTTP::uri]
HTTP::uri "/something$current_uri"
pool new-pool
}
elseif { [string tolower [HTTP::host]] equals "cccc.com" } {
HTTP::header replace "Host" "api.com"
set current_uri [HTTP::uri]
HTTP::uri "/something$current_uri"
pool new-pool
}
}