Irule for pool selection base on cookie presence

Hello,

I wish to do pool selection base on cookie presence.

The logic is simple, if any http request come with a specific cookie ( like JSESSIONID) it need to go to a pool, otherwise it need to go to another pool.

Any help be appreciated.

Regards, Kannan.

when HTTP_REQUEST {
  if {[HTTP::cookie exists {JSESSIONID}]} {
    pool mypool
  }
}

If you are looking to choose a pool juts on the presence of a cookie this should do the trick. It will require an HTTP profile. If your app is HTTPS it will also require a client SSL profile:

when HTTP_REQUEST {
    if {[HTTP::cookie exists "JSESSIONID"]}{
        pool poolA
    }
    else {
        pool poolB
    }
}