Forum Discussion

Shripaty's avatar
Shripaty
Icon for Cirrus rankCirrus
Oct 11, 2021

Redirect based on HTTP Header values to specific pool member

Hi ,

 

I have a scenario , where I want to redirect the traffic coming and identify the specific header named trust which has certain specific number , these numbers are in around 100 quantities which will be specific to calls generated from specific devices.

 

Point here I want to create a if rule to match the header value to a list of datagroup which contains the trust id and match accordingly and then redirect the traffic to certain pool.

 

Can this certain pattern be automated by declaring a regex parameter to randomly create the pools by replacing hostname for each trustid value ex trustid1.xyz.com

 

 

when HTTP_REQUEST {

 

if { [HTTP::header] exists "TRUST" } {

 

set trustnum [findstr [HTTP::header] value "trust"] 

 

foreach $trustnum {

 

if { ( [HTTP::header $trustnum] equals "trustnumberdatagroup" ) ne "" } {

 

pool { regex [trustnumberdatagroup] }

 

}

 

}

}else {

 

reject

 

}

 

}

 

Pool can be automated to use fqdn with reference from trust header value in the hostname part.

pool trustnumber-https {

 

member {

 

fqdn trustnum1.xyz.com === where trustnum1 is replaced by the trust value 

 

}

 

}

No RepliesBe the first to reply