cancel
Showing results for 
Search instead for 
Did you mean: 

Persistence based on id within XML file

Eric_Renner
Nimbostratus
Nimbostratus

Hello,

I'm trying to build an iRule which is doing universal persistence based on a string within the POST request of an xml file. This xml file contains the string <chatId>xxxxxxxxxxxxxxxx</chatId>. I want to parse the string between <chatId> and </chatId> to use it for persistence. This is necessary because cookie or source address persistence is not working as all requests comes from a single proxy IP and the clients are not supporting cookies. The http header also doesn't contains any data which can be used for persistence.

To get this work I've written the following rule:

when HTTP_REQUEST {

   if { (([HTTP::method] equals "POST") and ([HTTP::uri] contains "/chatSession")) } {

       HTTP::collect

       log local0. "Parsed payload: [HTTP::payload]"

   }

}

when HTTP_REQUEST_DATA {

      set SESSIONID [findstr [HTTP::payload] "chatId" 1 16]

      log local0. "Parsed chatId: $SESSIONID"

      persist uie $SESSIONID 120

       HTTP::release

}

I've added some log statements to see what is parsed from the request but unforetunately always an empty string is returned in the logfile and the client gets a timeout while trying to access the VIP.

Hope you can help me to get this solved

Many thanks in advance

 

2 REPLIES 2

Vijay_E
Altocumulus
Altocumulus

As a general check, I would recommend using OneConnect with /32 netmask when using L7 persistence. May be limit the data that is collected using HTTP::collect ? As a sanity check, can you verify and make sure you the case (upper/lower) is correct in the iRule when parsing data ?

 

 

I am new to iRules.

Http request is creating client side persistence. Dont we require http_response rule and persist add uie to maintain server side persistence.

 

Just a general question.