Forum Discussion

Eric_123944's avatar
Eric_123944
Icon for Nimbostratus rankNimbostratus
Jul 24, 2013

send connections to pool based on host header

Hello,

 

In an effort to reduce the number of public IPs we use, I'm trying to create an irule that will send connections to the proper pool based on host name. To do this, I was thinking of using a data group and came up with the following. The problem is it doesn't seem to work. Does anyone see anything horribly wrong with what I did?

 

 

when HTTP_REQUEST {

 

if { [class match [string tolower [HTTP::host]] equals PoolSelector] } {

 

set usepool [class match -value [string tolower [HTTP::host]] equals PoolSelector]

 

pool $usepool

 

}

 

}

 

 

My data group (PoolSelector) is type string with entries like the following

 

makeme.site.net := serverGroupA_pool

 

asammich.site.net := serverGroupB_pool

 

 

Thanks,

 

Eric

 

3 Replies

  • I don't see anything immediately wrong with it. Try adding a log statement at the beginning of the event declaration to show the incoming [HTTP::host] value, and another to show what $usepool equals.

     

     

    Does it not work at all, or intermittently? Do you have a OneConnect profile applied to the VIP?

     

     

    Are you seeing any errors in the LTM logs?

     

  • Jnon's avatar
    Jnon
    Icon for Nimbostratus rankNimbostratus
    Eric

     

     

    Are you stating you have some pool members with public addresses?

     

     

    I'm not getting where the public addresses your referring to are.
  • Hi Kevin,

     

    Thanks for your help. The [HTTP::host] and pool names were coming out correctly. It seems that it didn't like that I was pointing to some pools that were created via iapp. It was logging

     

    TCL error: /Common/OneRule - no such pool: serverGroupA_pool (line 1) invoked from within "pool $usepool"

     

    When I created pools manually, it worked just fine.

     

     

    Hi J,

     

    We were doing a 1:1 NAT from the public to the virtual IP, so practically every node gets mapped to it's own public IP. You might imagine how over time we have amassed quite a large amount of public addresses, with more servers going up all the time. Being able to use several pools under one VIP makes things a lot easier for me. I don't need to beg for more addresses every few months, and I don't need to worry about public DNS if I need to move a URL to a new server. I would just need to update the pool it uses in the data group and it would instantly take effect.