Forum Discussion

roliveira_76566's avatar
roliveira_76566
Icon for Nimbostratus rankNimbostratus
Aug 24, 2007

Routing diferent URLs to diferent Servers

Dear all,

 

 

If you could reply with an answer or point me to the right direction or documentation for the question below, I would be really thankful.

 

 

The string replacement talk about swapping characters on incoming strings but what theoretically we would like to do (and I need to know now because if we have performance issues then we need to make the change) is;

 

 

 

 

The following URLS requests would always be routed to go to BOX 1 (or in future cluster of servers 1)

 

 

 

 

Http://consult.company1.com (reroute from company1 domaim)

 

 

http://consult.company1.com

 

 

http://consult-london.company.com

 

 

 

 

i.e. anything with consult in URL (without hopefully adding all 200 names into a maintained list

 

 

 

 

All other urls go to Box2 (or in future cluster of servers 2)

 

 

Thank you very much

 

 

Renato

 

 

 

 

  • I think an HTTP class would be the easiest. You need to be at version 9.4 to use this. You just put in "consult*" or "http://consult*" into the HTTP class and point it to pool 1, then your virtual server would send all other matches to the pool associated with the virtual server.

     

    Click here

     

     

    Otherwise, a very basic iRule should do it.

     

    Click here

     

  • If you want to pursue the rule, the following should would for you:

    
    when HTTP_REQUEST {
      if { [string tolower [HTTP::host]] contains "consult"} {
        pool BOX1
      } else { pool BOX2 }
    }

    I made the assumption that you meant consult would be anywhere in the HOST. If that's not the case, you can also check the URI path ([HTTP::path]) and query ([HTTP::query]) information