Forum Discussion

Amit1992's avatar
Amit1992
Icon for Nimbostratus rankNimbostratus
Aug 04, 2021

Session ID persistence based on SessionID parameter in Xml tag

Iam trying to write I-rule based on following requirement 

 

  1. Client requests to initiate a session  F5 forwards the call to available Node in the pool.
  2.  
  3. Node sends response to F5 containing sessionid  F5 extracts sessionid from xml tag and creates a new persistence.
  4.  
  5. F5 then forwards the HTTP response to client  Client stores the sessionid .
  6.  
  7. Client uses the sessionid to create a new request using sessionid in the URL  F5 will parse the URL to retrieve the sessionid and use the existing persistence data to redirect the request to the right Node.
  8.  The F5 script should be clever enough to retrieve sessionid in a case-insensitive way and persist. F5 can distinguish first call from the subsequent calls by parsing the URL as the first call will not contain any sessionid text. 

 Can some one please help iam completely new to F5 .

 

Thanks Amit

  • Me too searching for same. For my case it's HTTP payload.

    when HTTP_RESPONSE {
    if {[string length [findstr [HTTP::header] "<return>" 8 "</return>"]] == 30} ---> Create your own logic to identufy string
    {
    set SESSIONID_RS [findstr [HTTP::header] "<return>" 8 "</return>"]
    log local0. "Response SessionID: $SESSIONID_RS"
    persist uie add $SESSIONID_RS 1800
    else {
    persist source_address}


    }
    }
    when HTTP_REQUEST {
    if {[string length [findstr [HTTP::header] "<arg0>" 6 "</arg0>"]] == 30}
    {

    set SESSIONID_RQ [findstr [HTTP::header] "<arg0>" 6 "</arg0>"]
    log local0. "Request SessionID: $SESSIONID_RQ"
    persist uie $SESSIONID_RQ 1800
    }
    }