LB decisions matching the headers
Hi, We have a custom written application that is being hosted on multiple servers behind the LTM. It does not use cookies rather a variety of unique http headers. I need to use these unique headers to make load balancing decisions.
Below first set of headers that should hit the pool_1
TEST/Rumba/mountainisred@4
TEST/Rumba/mountainisblue@2
TEST/Rumba/mountainisorange@2
TEST/Rumba/mountainisgreen@2
Below second set of headers that should hit the pool_2
TEST/Rumba/mountainispink@2
TEST/Rumba/mountainisgray@2
TEST/Rumba/mountainiswhite@2
TEST/Rumba/mountainisblack@2
Traffic with none of the above headers to hit a default_pool pool_3
Here is my iRule:
when HTTP_REQUEST { if { [HTTP::header value mountainisred@4} {
pool pool_1 } else {
pool main_pool
} }
Your response is much appreciated.
Thanks
Hi,
I would recommend the modified irule below, changed second if by elseif. Otherwise, If you match the first if you also match the else and you will have a tcl error and a tcp reset on thz client side :
when HTTP_REQUEST { if { [class match [HTTP::header "online.protocol.remote.contenttype"] equals header_value_1] } { pool_1 } elseif { [class match [HTTP::header "online.protocol.remote.contenttype"] equals header_value_2] } { pool_2 } else { pool_3 } }