Forum Discussion

amebiz_142234's avatar
amebiz_142234
Icon for Nimbostratus rankNimbostratus
May 23, 2018

irule pool selection based on cookie value

Hi,

 

Cookie value:

 

LocaleInformation:COUNTRYHAWKCODE%3DAT%7CJAVACOUNTRYCODE%3DAT%7CUSERSHOPLANGUAGE%3Dde%7C
LocaleInformation:COUNTRYHAWKCODE%3DAT%7CJAVACOUNTRYCODE%3DBE%7CUSERSHOPLANGUAGE%3Dfr%7C

i want to choose the pool based on a part in the cookie value

 

pseudo code

 

if cookie value include JAVACOUNTRYCODE%3DBE%7
pool AAA
elseif cookie value include JAVACOUNTRYCODE%3DAT%7
pool BBB

i think it is better to use a switch -glob but i'm not sure is that possible? any ideas? thanks 4 your help

 

  • Hi,

    you can already try this:

    when HTTP_REQUEST {
    
    if { [HTTP::cookie exists "LocaleInformation"] and [HTTP::cookie value "LocaleInformation"] contains "JAVACOUNTRYCODE%3DBE%7" }{
    pool AAA
    } elseif { [HTTP::cookie exists "LocaleInformation"] and [HTTP::cookie value "LocaleInformation"] contains "JAVACOUNTRYCODE%3DAT%7" }{
    pool BBB
    } else {
    pool default
    
    }
    
    }