Forum Discussion

Dinesh3888's avatar
Dinesh3888
Icon for Nimbostratus rankNimbostratus
Feb 02, 2015

Help on irule creation.

Hi All,

 

Need help on creating a irule. when i hit a site for example 12345abc.xyz.com or 9876abc.xyz.com i need the traffic to be destined to pool_A.because we are running lot of application starting with prefix *abc.xyz.com . i tried below irule and it was failing. please help on it.

 

when HTTP_REQUEST { if { [HTTP::host] contains "*abc.xyz.com" } { pool spcatalogqa_apps_80 } else {

 

1 Reply

  • Hi,

    Please try the solution below:

    when CLIENT_ACCEPTED {
       set POOL_DEFAULT [LB::server pool]
    }
    
    when HTTP_REQUEST {
      if { [HTTP::host] contains "abc.xyz.com" }{
        pool pool_A
      } else {
        pool $POOL_DEFAULT
      }
    }
    

    Alternatively, if you have a ton of HOST values and different pools, try using:

    when CLIENT_ACCEPTED {
       set POOL_DEFAULT [LB::server pool]
    }
    when HTTP_REQUEST {
      switch -glob [HTTP::host] {
        "*abc.xyz.com" {
          pool pool_A
        }
        "*def.xyz.com" {
          pool pool_B
        }
        default {
         pool $POOL_DEFAULT
        }
      }
    }