Forum Discussion

Cadu's avatar
Cadu
Icon for Nimbostratus rankNimbostratus
Feb 05, 2020

irule to redirect based on HTTP header

Hi guys,

 

I am not a professional coder and Im trying to find and start to develop a irule to redirect our HTTP request to a especific pool, but cant find nothing similar to start a new one.

 

Our LTM receives from the browser an HTTP header with this information:

 

VALIDADOR_USER: 10\r\n (I take it just equals from the wireshark, the number is random 10-27)

 

I want to try a code that will take it number from VALIDADOR_USER and load balance to 4 diffent pools.

 

i.e.:

 

if VALIDADOR_USER: 10 or 11 or 12 or 15 > pool_1

if VALIDADOR_USER: 16 or 17 or 18 or 19 > pool_2

if VALIDADOR_USER: 20 or 21 or 22 or 23 > pool_3

if VALIDADOR_USER: 24 or 25 or 26 or 27 > pool_4

 

I wonder if its possible to do something based on comparing this values through datagroups and if it matches the LB will be trigged..

 

Please, can you guys give me a help ?

 

Regards,

 

Cadu.

 

 

  • when HTTP_REQUEST {

     if { [HTTP::header "Host"] contains "uat" } {

      pool uat_pool

     } else {

      pool main_pool

     }

    }