HTTP Payload Parsing not working as expected
Hello,
I am trying to load balance based of a UN string seen in the HTTP Payload, i was able to do this in TCP Payload for another VIP without any issues.I have tried multiple iterations of irules to accomplish this, i used a dev central irule to extract the http headers and this is an excerpt i am focusing on.
Basically I want to inspect the HTTP payload and loadbalance based on the value after UN:
Apr 24 18:13:38 local/tmm7 info tmm7[6915]: Rule HTTP_Inspect_Extract_Irule : ============================
Apr 24 18:13:38 local/tmm7 info tmm7[6915]: Rule HTTP_Inspect_Extract_Irule : <<< HTTP Headers >>>
Apr 24 18:13:38 local/tmm7 info tmm7[6915]: Rule HTTP_Inspect_Extract_Irule : OP: 0
Apr 24 18:13:38 local/tmm7 info tmm7[6915]: Rule HTTP_Inspect_Extract_Irule : UN: xxxxxxxxxxx
Apr 24 18:13:38 local/tmm7 info tmm7[6915]: Rule HTTP_Inspect_Extract_Irule : PW: yyyyyyyyyyy
Apr 24 18:13:38 local/tmm7 info tmm7[6915]: Rule HTTP_Inspect_Extract_Irule : client_source: zz
Apr 24 18:13:38 local/tmm7 info tmm7[6915]: Rule HTTP_Inspect_Extract_Irule : client_version: 6.2.0.17
Apr 24 18:13:38 local/tmm7 info tmm7[6915]: Rule HTTP_Inspect_Extract_Irule : app_type: APPLICATION
Apr 24 18:13:38 local/tmm7 info tmm7[6915]: Rule HTTP_Inspect_Extract_Irule : app_name: zz
Apr 24 18:13:38 local/tmm7 info tmm7[6915]: Rule HTTP_Inspect_Extract_Irule : User-Agent: Java/1.6.0_26
Apr 24 18:13:38 local/tmm7 info tmm7[6915]: Rule HTTP_Inspect_Extract_Irule : Host: something.abc.com
Apr 24 18:13:38 local/tmm7 info tmm7[6915]: Rule HTTP_Inspect_Extract_Irule : Accept: text/html, image/gif, mage/jpeg,*; q=.2, */*; q=.2
Apr 24 18:13:38 local/tmm7 info tmm7[6915]: Rule HTTP_Inspect_Extract_Irule : Connection: keep-alive
Apr 24 18:13:38 local/tmm7 info tmm7[6915]: Rule HTTP_Inspect_Extract_Irule : <<< URI >>>
Apr 24 18:13:38 local/tmm7 info tmm7[6915]: Rule HTTP_Inspect_Extract_Irule : HTTP::uri: /ff/ggggggg
Here are some of the irules I have tried without success, any idea's are greatly appreciated.
-----------------------------------------------------------------------
when HTTP_REQUEST {
if { [HTTP::header "UN:"] contains "@ATEST4" } {
pool Leg1
} else {
pool Leg2
}
}
-----------------------------------------------------------------------(tried using a class below)-----
when HTTP_REQUEST {
if {[class match [HTTP::header "User-Agent"] contains UserID] } {
pool Leg1
} else
pool Leg2
}
-----------------------------------------------------------------------
when CLIENT_ACCEPTED {
HTTP::collect 1500
}
when CLIENT_DATA {
log local0. "in CLIENT_DATA"
if { [HTTP::payload] contains "xxxxx" } {
pool Leg1
} else {
pool Leg2
}
HTTP::release
}
-----------------------------------------------------------------------
when CLIENT_ACCEPTED {
TCP::collect 1000
}
when CLIENT_DATA {
log local0. "in CLIENT_DATA"
if { [TCP::payload] contains "xxxxx" } {
pool Leg1
} else {
pool Leg2
}
TCP::release
}
______________________________________________________