Forum Discussion

Puneet_73909's avatar
Puneet_73909
Icon for Nimbostratus rankNimbostratus
Sep 09, 2009

Redirection to another LB Virtual Server

Hi,

 

 

I am trying to redirect HTTP request to another Virtual Server(configured on different Load Balancer) If request comes with uri: "/abc". I need help to write an irule for same which I am unable to do so.

 

 

Thanks,

 

Puneet Khanna

 

  • Hi Puneet,

    Here is a example of a simple redirection

     
     when HTTP_REQUEST {  
      if { [HTTP::uri] eq "/abc" } {  
         HTTP::redirect "HTTP://anothervirtualserverdomain.com/"  
         }  
     }  
     

    Hope this helps

    CB
  • CB,

     

     

    I have different rquirement...

     

     

    When request comes in...

     

     

    http://int1.abc.com/ => Redirects to original pool in Production environment

     

     

    and when Request come with ....

     

     

    http://int1.abc.com/distcache-sample/ => it should redirect to new VIP which is configured on different LB in QA environment.

     

     

  • well you can write that in the following way

     
     when HTTP_REQUEST { 
       if { [HTTP::host] eq "int1.abc.com" } { 
           switch -glob [HTTP::uri] { 
            "/" { pool original_pool } 
            "/distcache-sample" { HTTP::redirect "HTTP://anothervirtualserverdomain.com/" } 
          } 
        } 
      } 
     

    CB