Forum Discussion

William_Murphy1's avatar
William_Murphy1
Icon for Nimbostratus rankNimbostratus
Mar 21, 2007

Mixing HTTP_REQUEST && HTTP_REQUEST_DATA

Hi All,

 

Looking for some help on this irule.I currently have the following irule:

 

 

when HTTP_REQUEST {

 

set redirectPort [ getfield [HTTP::host] ":" 2]

 

log local0. "port: $redirectPort"

 

if { $redirectPort equals "8003" } {

 

pool MMF_pool_8003

 

} elseif { $redirectPort equals "8004" } {

 

pool MMF_pool_8004

 

} else {

 

pool MMF_pool

 

}

 

}

 

 

The logical thinking in the above is:

 

 

Check HTTP Headers to get Host Port .According to this Host Port then the traffic is separated into different pools.

 

 

But i wish to put in an extra "else if" in the middle, that checks Http Data, checks first couple of bites and then assign a pool according to this.

 

 

Is this possible?

 

 

Regards,

 

William

1 Reply

  • Hi all,

     

    An update on this. Have tried the following to see if it works:

     

     

    when HTTP_REQUEST {

     

    set redirectPort [ getfield [HTTP::host] ":" 2]

     

    binary scan [HTTP::payload] HexPayLoad

     

    if { $redirectPort equals "8003" } {

     

    pool MMF_pool_8003

     

    log local0. "GET:3"

     

    } elseif { $redirectPort equals "8004" }{

     

    pool MMF_pool_8004

     

    log local0. "GET:4"

     

    } elseif { $HexPayLoad starts_with "8C80" } {

     

    pool MMF_pool

     

    log local0. "Post"

     

    } else {

     

    pool MMF_pool_8002

     

    }

     

    }

     

     

    Irules editor accepts but getting errors in F5 logs.

     

     

    Having trouble reading HexPayLoad.

     

     

    Mar 21 17:09:55 tmm tmm[692]: 01220001:3: TCL error: Rule irule_poolMembers_PostsGets_separate - can't read "HexPayLoad": no such variable while executing "if { $redirectPort equals "8003" } { pool MMF_pool_8003 log local0. "GET:3" } elseif { $redirectPort equals "8004" }{ ..."

     

     

     

    Any help would be appreciated.

     

     

    Will