Forum Discussion

Jace_45978's avatar
Jace_45978
Icon for Nimbostratus rankNimbostratus
Feb 10, 2009

need iRule redirect help

Hi,

 

I am in the process of converting CSS content/services to LTM Virtuals/members.

 

 

I came across two contents with same IP.. a rule is applied to one that says if header contains "dfinder.xx.com" then go to these services. If connection to virtual does not contain "dfinder.xx.com" it will go to the other services associated with the other content.

 

 

So I am looking for iRule that I can apply to a single Virtual that says if the request has "dfinder.xx.com" go to pool_dfinder otherwise go to pool_common

 

 

I am pretty sure this can be achieved with iRule but being new at iRules I would like some assistance please.

 

thanks

 

  • James_Quinby_46's avatar
    James_Quinby_46
    Historic F5 Account
    In the header? Or somewhere in the URI? If it's in the URI, something along these lines will probably do the trick:

      
     when HTTP_REQUEST {  
     if {[HTTP::uri] equals {dfinder.xx.com}} {  
     pool pool_dfinder  
     }  
     }  
     }  
     

    This rule assumes that 'pool_common' is the default pool assigned to your virtual server. If you're looking in the header for 'dfiner.xx.com', you'd want this:

      
     when HTTP_REQUEST {  
     if { [HTTP::header "Foo"] equals "dfinder.xx.com" }  {   
     pool pool_dfinder  
     }   
     }  
     

    ...though you'd obviously want to change "Foo" to whatever header contains the value 'dfinder.xx.com'.

    There's more on testing headers here:

    http://devcentral.f5.com/wiki/default.aspx/iRules/HTTP__header.html