http get
1 TopicPersistence Across HTTP Methods
Problem this snippet solves: This code will provide persistence across GET & POST HTTP Methods using Client IP & SessionID as the persistence key. How to use this snippet: This code provides a simple structure that can be adapted to specific use cases. The code can be used as a standalone iRule or used along with Universal Persistence. It is recommended to enable OneConnect profile for this code in order to process individual HTTP Requests. Code : when HTTP_REQUEST { set HOST [string tolower [HTTP::host]] set SRCADDR [IP::remote_addr] if { $HOST contains "domain.com" } { #Match on HTTP Method GET if { [HTTP::method] equals "GET" } { set SESSIONID [findstr [HTTP::uri] "uuid=" 5 20] set KEY [crc32 $HOST$SESSIONID] #Persistence based on source address & session id present in URI persist hash $KEY 14400 #Start collecting content provided by POST method } elseif { (([HTTP::method] equals "POST") and ([HTTP::uri] contains "/amm/ampxml.jsp")) } { if {[HTTP::header "Content-Length"] ne "" && [HTTP::header "Content-Length"] <= 1048} { set CONTENT [HTTP::header "Content-Length"] } else { set CONTENT 1048 } if { $CONTENT > 0 } { HTTP::collect $CONTENT } } } } #Persistence based on the POST content when HTTP_REQUEST_DATA { if { (([HTTP::method] equals "POST") and ([HTTP::uri] contains "/amm/ampxml.jsp")) } { set HOST [string tolower [HTTP::host]] set SESSIONID [findstr [HTTP::payload] "uuid=" 5 20] set KEY [crc32 $HOST$SESSIONID] persist hash $KEY 14400 } } Tested this on version: 11.5253Views0likes0Comments