Forum Discussion

Ahmed_Mahmood_1's avatar
Ahmed_Mahmood_1
Icon for Nimbostratus rankNimbostratus
Feb 27, 2008

Select Pool Member based on URI or Header

Hi,

 

I need to direct https requests to a certain pool member based on information included in the URI and need to know if this is possible.

 

 

For example, https://mydomain.com?host1:p1 needs to always go to the pool member that has hostname host1 and listens on tcp port p1

 

 

Is this possible?

 

 

If it is, then can this be made dynamic or is it hardcoded into the iRule and needs to be updated each time a new server is added?

 

 

Any help is apprecaiated...

 

 

thx,

 

  • Hi,

     

     

    To do so you'll need the BIGIP to be the SSL termination.

     

     

    You can make it dynamic with something like this

     

     

    Let's say we respect your syntax

     

    ex:

     

    https://mydomain.com?192.168.155.2

     

     

    This should do the job:

     

     

    when HTTP_REQUEST {

     

    set pool_member [findstr [HTTP:uri] "?" 1]

     

    pool member $pool_member

     

    }

     

     

    Be careful this is just an example, if your website send any kind of data within the uri it will not work.

     

     

    If you specify the ip with a parameter it will be better:

     

    https://mydomain.com?member=192.168.155.2

     

     

    then you do this:

     

     

    when HTTP_REQUEST {

     

    set pool_member [findstr [HTTP:uri] "member=" 7 "&"]

     

    pool member $pool_member

     

    }

     

     

    Should work too

     

     

    HTH
  • Great, thanks for the feedback...

     

    The BigIP being the SSL termination is not a problem.

     

     

    I have this question:

     

     

    Will this work if we have a hostname instead of an IP? Can the BigIP resolve an Internal DNS name?

     

     

    Also in our case, we have multiple worker applications on the same physical server all using the same IP but responding to different Port numbers. Is there any way we could pass multiple parameters having one of them as the tcp port? Example:

     

     

    https://mydomain.com?member=worker1,port=3000

     

     

    where pool member1 = worker1 port 3000

     

     

     

    What if we have a code? Can we build a table as follows:

     

     

    https://mydomain.com?member=alias1

     

     

    where:

     

    alias1=worker1 port 3000

     

    alias2=worker1 port 3001

     

    alias3=worker2 port 3000

     

    :

     

    :

     

    ...etc.

     

     

     

    Is this a valid option?

     

     

    I really apprecaite your help...

     

     

    thx,

     

  • In regards to passing load balancing information in the URI you first need to know how to parse it. An article explains that : http://devcentral.f5.com/Default.aspx?tabid=63&articleType=ArticleView&articleId=18

     

     

    Working with nmenant idea you can come up something that works.