Forum Discussion
Persistence based on XML data
It has been a while since I tested this iRule out. However, I have used it in the past successfully in 10.x and 11.x code version. The code provides persistence based on jsession id for GET request and xml data for POST request.
You would have to alter the code to suit your specific needs:
when HTTP_REQUEST {
set HOST [string tolower [HTTP::host]]
set SRCADDR [IP::remote_addr]
if { $HOST contains ".v." }{
if { [HTTP::method] equals "GET" } {
set SESSIONID [findstr [HTTP::uri] "uuid=" 5 20]
set KEY [crc32 $HOST$SESSIONID]
persist hash $KEY 30
} 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
}
} elseif { $HOST contains ".suit.domain.com" } {
pool POOL-suit
set KEY [crc32 $HOST$SRCADDR]
persist hash $KEY 14400
} elseif { $HOST contains ".suit.vf.com" } {
pool POOL-vf-suit
set KEY [crc32 $HOST$SRCADDR]
persist hash $KEY 14400
}
}
}
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 30
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com