Forum Discussion

Dale_Lindsay_19's avatar
Dale_Lindsay_19
Icon for Nimbostratus rankNimbostratus
May 05, 2008

New to iRules need a starting point

I'm new to iRules. I need to be able to take a specific url and if it has specific content in the url, send it to a specific server. All over traffic can be load-balanced normally to the two servers in the pool.

 

 

Could someone let me know how this looks? I may be able to expand from there.

3 Replies

  • This should get you started. Note that the myPool and defaultPool can be the same pool, that depends on your requirements.

    
    when HTTP_REQUEST {
      if { [string tolower [HTTP::uri]] contains "your string here" } {
        pool myPool member 10.10.10.10
      } else { pool defaultPool }
    }
  • Hi again,

     

     

    I finally had a chance to try this and it does not appear to work. When traffic inbound matches the "contains" field, the Bigip is still sending traffic to either server. Here is what I have:

     

     

    when HTTP_REQUEST {

     

    if { [string tolower [HTTP::uri]] contains "sdpversion1" } {

     

    pool DALE_POOL member 192.168.138.50

     

    } else { pool DALE_POOL }

     

    }

     

     

    Any help appreciated!
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    That iRule looks fine. Have you checked to make sure that it's applied to the appropriate Virtual, and that the traffic in question is actually going through that virtual? If you add a log statement to the iRule to log the HTTP::uri, what does the log file in /var/log/ltm show?

     

     

    Colin