Forum Discussion

Amith_Rajgopal_'s avatar
Jun 09, 2021

Maintaining persistancy based on Unique transaction ID for 2 different URI

Team,

 

Explaining a bit about scenario. Customer has requirement of sending certain traffic to specific node within a pool for 2 different URI with same transactionID (attaching snapshot for 2 sample transcationID) . The objective is api /req and api /resp should land on same node. Below irule seems not working as expected. the below irule is attached to persistancy uie and attached to vs.

 

when HTTP_REQUEST {

set txnid [findstr [HTTP::uri] "urn:txnid:" 10 ";"]

# set txnid [string range $string1 10 end]

# log local0. " Printing txnid: $txnid for [HTTP::uri]"

if { $txnid != "" } {

persist uie $txnid

}

}

 

Have done a bit of modification, can you please look into this and suggest any modifications. The new sample irule:

when HTTP_REQUEST {   

  if { (([string tolower [HTTP::uri]] contains "/upi/respbalenq/") or ([string tolower [HTTP::uri]] contains "/upi/reqbalenq/") and ( [string tolower [HTTP::uri]] contains "/urn:txnid:auto" ) } {  

set txnid [findstr [HTTP::uri] "urn:txnid:" 10 ";"]

#set string1 [findstr [HTTP::URI] "urn:txnid:"]

#set txnid [string range $string1 10 end]

 Log local0. " Printing txnid: $txnid for [HTTP::uri}"

 if { $trxnid != ""} {

     persist uie $txnid

   pool inq_bal

   } else {

      return

  }

}

 

In the snapshot 10.20.210.22 is selfip and 10.20.19.99 / 100 / 101 are backend servers. Objective is if transaction ID is same for both api (req and resp) , it should always land on same node.