Forum Discussion

Alex_Tiplitsky_'s avatar
Alex_Tiplitsky_
Icon for Nimbostratus rankNimbostratus
Apr 12, 2005

Multiple iRules for a Virtual + HTTP redirect

I currently have an iRool that' redirecting traffic to a certain pool:

 
 when HTTP_REQUEST { 
  if { [HTTP::uri] contains "psreports" } { 
     pool CRMWEB_REPORTS 
  } 
  elseif { [HTTP::uri] contains "PSOL" } { 
     pool CRMWEB_PSOL 
  } else { 
     pool CRMWEB 
  } 
 } 
 

I also need to be able to redirect traffic from:

http://mycrm.xxx.com to http://mycrm.xxx.com/psp/crmprd01/?cmd=login

and the same for https.

 
 when HTTP_REQUEST { 
    if { [HTTP::uri] equals "mycrm.xxx.com" } { 
      redirect to "http://mycrm.xxx.com/psp/crmprd01/?cmd=login" 
    } 
 } 
 

While the first rule is working perfectly, second one is not...

I am probably making a bunch of errors in the second rule...

PLEASE HELP!

2 Replies

  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    I think you might want HTTP::host in the second rule since HTTP::uri returns the URI path and not the host.
  • Let me correct myself:

     
     when HTTP_REQUEST {   
        if { [HTTP::uri] equals "/" } {   
           redirect to "http://mycrm.xxx.com/psp/crmprd01/?cmd=login"   
        }   
     } 
     

    What I can't figure out is how to make both rules to work on the same Virtual...

    Can I possibly combine them in one rule to look something like:

     
     when HTTP_REQUEST {  
       if { [HTTP::uri] equals "/" } {    
           HTTP::redirect "http://mycrm.xxx.com/psp/crmprd01/?cmd=login"  
       }  
       elseif { [HTTP::uri] contains "psreports" } {  
          pool CRMWEB_REPORTS  
       }  
       elseif { [HTTP::uri] contains "PSOL" } {  
          pool CRMWEB_PSOL  
       } else {  
          pool CRMWEB  
       }  
     }  
     

    Your help is HIGHLY appreciated!