cancel
Showing results for 
Search instead for 
Did you mean: 
Login & Join the DevCentral Connects Group to watch the Recorded LiveStream (May 12) on Basic iControl Security - show notes included.

Redirect requests to second VIP (VIP to VIP redirection)

Sabir_Alvi
Altocumulus
Altocumulus

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...

5 REPLIES 5

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

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.

Is your requirement got fulfilled ?

 

Mayur

Yoann_Le_Corvi1
Cumulonimbus
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