13-Feb-2020 14:20
We have 2 different VIPs created with different profile configurations. We need to redirect traffic for a particular URI to the Second VIP, while everything else is handled by the First VIP. We have tried below iRules but it hasn't helped, the request is not getting redirected to Second VIP. Any help would be highly appreciated!! We have logging enabled and it only says the request was sent to the pool on First VIP.
when HTTP_REQUEST {
log local0. "Request to: [HTTP::host] from [IP::client_addr]"
switch -glob [string tolower [HTTP::host][HTTP::uri]] {
"something.com/blah/blah/blah.svc*" {
virtual second_vip_name
}
}
}
when HTTP_REQUEST {
log local0. "Request to: [HTTP::host] from [IP::client_addr]"
set uri [string tolower [HTTP::uri]]
if { ( $uri contains "/blah/blah/blah.svc")
} {
virtual second_vip_name
}
}
I referred this as well - https://devcentral.f5.com/s/articles/20-lines-or-less-64-vip-to-vip-redirection-url-separation-and-r...
13-Feb-2020 18:49
Hey,
Try this iRule,
when HTTP_REQUEST {
if {([string tolower [HTTP::uri]] contains "/xyz") and [string tolower [HTTP::host]] equals "abc"}{
HTTP::redirect https://xyz;
}
}
Also you can even try F5 Policy to match URI n redirect traffic.
Hope it helps !
Mayur
13-Feb-2020 20:09
Hi - this iRule doesn't look like it is redirecting traffic to second VIP. I can get the URL redirection done like your iRule if it needs to go through same VIP, however that's not what I want. Because I'm using different profile settings in second VIP for certain URI, I need it to go through second VIP.
16-Feb-2020
18:27
- last edited on
24-Mar-2022
01:09
by
li-migration
Check below article.
https://devcentral.f5.com/s/question/0D51T00006i7kHX/irule-to-redirect-to-another-vs-on-the-same-ltm
Hope it helps!
Mayur
18-Feb-2020 21:02
Is your requirement got fulfilled ?
Mayur
14-Feb-2020
00:04
- last edited on
24-Mar-2022
01:09
by
li-migration
Hi,
I tend to agree with
Whenever you can, use an LTM policy with Foward To Virtual Server action. I use this quite often to implement "Virtual Servers Brokers".
Yoann