Forum Discussion

ucgwebmaster_95's avatar
ucgwebmaster_95
Icon for Nimbostratus rankNimbostratus
Jun 11, 2008

URL redirect to different pool

I have an urgent need and I am not sure how to do this. I have a pool of 2 nodes which use host headers on the same IP in IIS. I need to take one of the DNS names and redirect traffic to a different node in a different pool.

 

 

e.x. www.abc.com would redirect to pool 2 all other request would redirect to pool 1.

 

 

This would also need to work for all uri's.

 

 

Any help would be greatly appreciated.

 

 

Thank you,

 

 

F5 Newbie in need
  • I just thought about it and I put in miss information.

     

    I would really like to add a 3rd member to the pool the VS is using. I need the rule to send client requests to this node based on the http://www.something.com and http://www.something.com/*
  • here is the host header irule, fwiw:

     

     

    when HTTP_REQUEST {

     

    switch [HTTP::host] {

     

    www.site1.com {

     

    pool pool_site1

     

    persist cookie

     

    }

     

    www.site2.com {

     

    pool pool_site2

     

    persist cookie

     

    }

     

    www.site3.com {

     

    pool pool_site3

     

    persist cookie

     

    }

     

    default { reject }

     

    }

     

    }
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    The default reject statement will say that if the switch cases aren't matched, it will reject the incoming request. If that's not what you're looking for, you can modify the action there, or remove the default clause all-together.

     

     

    Colin
  • So just to be clear:

     

     

    I have a Virtual Server which resolves to several DNS names (www.abc.com, www.def.com, www.ghi.com). I have a pool of 2 nodes which currently the Load Balanced traffic is directed to. I want to take www.abc.com and send it to a different pool with a different node. All other requests should remain going to the default pool of the VS.

     

     

    If I use the default reject, does that mean anything outside of the hosts defined are using the default pool?

     

     

     

    VS. 192.168.80.100

     

    Pool1 - 172.16.80.1 and 172.16.80.2(Default Pool for 192.168.80.x)

     

     

    DNS (192.168.80.x) - www.abc.com, www.def.com, www.ghi.com etc)

     

     

     

    Pool2 - 172.16.80.3 - Only traffic with the host www.abc.com or www.def.com should go here. All other traffic should go to Pool1

     

     

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    You don't need the reject statement. What that switch statement is saying is:

     

     

    If I the HTTP Host address is "www.site2.com", send to pool pool_site2 and use the cookie persist profile.

     

     

    If the HTTP Host address is "www.site3.com", send to pool pool_site2 and use the cookie persist profile.

     

     

    If the HTTP Host address is neither of the above, reject the connection.

     

     

     

    It sounds like you can remove the default section all together, and still have the functionality you want.

     

     

    Colin
  • Please forgive me, I am brand new to this....

     

     

    Do these rules assume that the url is formed exactly like the case? Example

     

     

    www.myurl.mycompany.com is the same as myurl.mycompany.com as is myurl when referring to an internal name for an application.

     

     

    is there a "like" argument that can include just myurl which should be inclusive of all 3 instances I listed above?

     

     

    My problem is similar to the one above, however I am trying to switch on multiple levels.

     

     

    Example:

     

     

    myurl\servicegroup1\webservice1 - forward to pool 1

     

    myurl\servicegroup1\webservice2 forward to pool 2

     

    myurl\servicegroup2\webservice1 - forward to pool3

     

    myurl\servicegroup2\webservice1 - forward to pool3

     

     

    I have a complex group of webservices, some which need to be load balanced by "servicegroup" and others which need to be load balanced by the actual service. My current application includes 30 VIPS to accomplish these needs. I am attempting to use the LTM to consolidate these down to one VIP with an iRule which will send traffic to the appropriate pool. The example above is a good start, however my environment is slightly more complex and I need more information.

     

     

    Any direction you can provide me is appreciated!