Forum Discussion
Redirect requests to second VIP (VIP to VIP redirection)
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-redirect-rewriting
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
- Sabir_Alvi
Altocumulus
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.
Check below article.
https://devcentral.f5.com/s/question/0D51T00006i7kHX/irule-to-redirect-to-another-vs-on-the-same-ltm
Hope it helps!
Mayur
- Yoann_Le_Corvi1
Cumulonimbus
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
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