Forum Discussion

TJ_Vreugdenhil's avatar
Jun 28, 2017

irule to match on 2nd parameter name and value

I want to capture on the 2nd parameter name and value. If memid=x then send to this node. However, the irule is only matching the tokenid portion. But I can only get it to match on tokenId (the first parameter).

Here is the test URI: 

http://test.domain.org/HBNetRD/App/Signon/SSOInit?tokenId=r43DRErQu0CpO_smc2kEfSzGEn6w&memid=1
`


Could I be hitting this bug. I am on 12.1.2:
[https://devcentral.f5.com/questions/uri-query-question-20954](https://devcentral.f5.com/questions/uri-query-question-20954)

`when HTTP_REQUEST {
   switch [string tolower [HTTP::query] {
    "memid=1" { node 1.1.1.1] }
    "memid=2" { node 2.2.2.2] }
    "memid=3" { node 3.3.3.3] }
    "memid=4" { node 4.4.4.4] }
    "memid=5" { node 5.5.5.5] }
    default { pool p80_pool }
  }
  log local0. "Sending HTTP path [HTTP::query] to node [LB::server addr]"
}

curl -I http://10.1.10.20/?token=123&memid=5
Jun 28 10:40:28 F51_v12 info tmm1[12424]: Rule /Common/MEMBER_TO_OLB : Sending HTTP query /?token=123 to node /Common/p80_pool 0


It will match on this: 
?token=123memid=1

not this: 
?token=123&memid=1
  • Hi,

    you can use this irule:

    when HTTP_REQUEST {
       switch [string tolower [URI::query [HTTP::uri] memid]] {
        "1" { node 1.1.1.1] }
        "2" { node 2.2.2.2] }
        "3" { node 3.3.3.3] }
        "4" { node 4.4.4.4] }
        "5" { node 5.5.5.5] }
        default { pool p80_pool }
      }
      log local0. "Sending HTTP path [HTTP::query] to node [LB::server addr]"
    }