Forum Discussion

Tim_Vaudt_11296's avatar
Tim_Vaudt_11296
Icon for Nimbostratus rankNimbostratus
Sep 05, 2012

Need to change HTTP header depending on pool member selected

Based on a pool member selected we need to change the Host name in HTTP::header before the request is sent to the target server. I have tried to do this with the following iRule but there is an error being thrown when the HTTP::header replace is being processed.


 
 when SERVER_CONNECTED {
     log local0. "Connected to [IP::server_addr]"
     switch [IP::server_addr] {
        "1.2.3.4" -
        "1.2.3.5" {
           log local0. "Found IP in the legacy list.  Will not modify HTTP header"
        }
        "2.3.4.5" {
           log local0. "Found IP in the new list.  Modify HTTP header"
           HTTP::header replace Host "newhost.com"
        }
     }
}

This is failing with operation not support:

Sep 4 15:11:10 local/tmm2 err tmm2[7000]: 01220001:3: TCL error: tcv - Operation not supported (line 1) invoked from within "HTTP::header replace Host "newhost.com" " ("2.3.4.5" arm line 3) invoked from within "switch [IP::server_addr] { "1.2.3.4" - "1.2.3.5" { log local0. "Found IP in the legacy list. Will not modify ..."

I tried this with "when HTTP_REQUEST" as well, but since there is no pool member selected yet, that wasn't working either. In this configuration, there are 3 members in the pool:

1.2.3.4

1.2.3.5

and

2.3.4.5

Any suggestions on if this is possible?