Forum Discussion

Brian_Ott_11267's avatar
Brian_Ott_11267
Icon for Nimbostratus rankNimbostratus
Jul 29, 2007

host header inspection

I want to do host header inspection to decide which pool to send traffic to. For example create one VIP that has multiple domain names tied to it, say:

 

 

disney.apple.com 10.2.2.4

 

pixar.apple.com 10.2.2.4

 

 

if the request uses disney.apple.com:

 

use pool disney.apple.com

 

 

if the request uses pixar.apple.com:

 

use pool pixar.apple.com

 

 

This way I can have 1 IP tied to multiple names.

 

 

I am in a situation where I have 100+ IPs on my box and it causes us some problems, so if I used host header based inspection I could lower this down to 1 IP and multiple pools.

 

 

To do this, do I have to use an iRule?

 

 

If so, I imagine I can do(pseudo code):

 

if pool exists ::hostheader:: then

 

use pool ::hostheader::

 

else

 

use pool default

 

 

In the case where my pool names match my host headers.

 

 

Am I accurate in my guessing? I have 0 experience with iRules.

1 Reply

  • You can use the pool command with the Host header value in combination with the catch command to capture errors.

    Here is an example that logs to /var/log/ltm:

    
    when HTTP_REQUEST {
       log local0. "client: [IP::client_addr] -> [HTTP::host][HTTP::uri]"
       if { [catch { pool [HTTP::host]}] }{
          log local0. "pool [HTTP::host] doesn't exist!"
          pool default_pool
       }
    }

    'pool [HTTP::host]' will specify the value of the Host header as the pool. If the pool doesn't exist, it will generate an error which 'catch' will catch and return true. If catch returns true, then the default pool will be used.

    Aaron